Lookup Table
Posted: Tue May 05, 2020 5:35 pm
Is there a way to reference a specific lookup table with a string?
The previous way we would access a lookup table (ex: below) requires passing in a type for the context, this requires a reference to the 'Softpro.OrderTracking.Order' assembly, which is only made available when you open an order and not an assembly we can access directly.
But we are now trying reference a lookup table in another application (this is a separate maintenance/configuration style application and does not reference nor open any orders). This means we do not have a LoanPolicy object or a reference to the 'SoftPro.OrderTracking.Order' library that it appears to reside in.
Is there another way to query the lookup tables (via string preferably) or a way to get a direct reference to 'SoftPro.OrderTracking.Order' so we can reference the types in it for the 'ILookupMap.TryGet()' call (without requiring opening an order to trigger the assembly load from the service)?
The previous way we would access a lookup table (ex: below) requires passing in a type for the context, this requires a reference to the 'Softpro.OrderTracking.Order' assembly, which is only made available when you open an order and not an assembly we can access directly.
Code: Select all
var lookupService = SelectServer.GetService<ILookups>();
ILookupMap map = lookupService.GetLookupMap(Order.OwnershipProfile);
ILookupMapEntry entry = null;
if (!map.TryGet(LoanPolicy.GetType(), ".InsuredMortgageLookupCode", out entry))
{
InsuredMortgage_radDropDownList.Enabled = false;
return;
}
var spec = new LookupQuerySpec
{
SchemaOnly = false,
Table = entry.Name
};
var table = lookupService.QueryTable(spec);
var rows = new List<string> { string.Empty };
rows.AddRange(table.Rows.Select(x => x[0].Value.ToString()));
Is there another way to query the lookup tables (via string preferably) or a way to get a direct reference to 'SoftPro.OrderTracking.Order' so we can reference the types in it for the 'ILookupMap.TryGet()' call (without requiring opening an order to trigger the assembly load from the service)?