History formula

This formula is used to show the dataset containing all service requests associated with the loaded address when the History tab is selected in Call Center.

Dim sProductFamily as string 
Dim sTableName as string 
Dim res as Hansen.Core.Result 
Dim addr as Hansen.Property.IAddress 
sProductFamily = "CRM" 
sTableName = "ServiceRequest" 
' 'Add to collection of selects 
colSelect.Add( new IDOperativeByCommonID( sProductFamily, sTableName + ".ServiceRequestNumber" ) ) 
colSelect.Add( new IDOperativeByCommonID( sProductFamily, sTableName + ".Address.AddressKey" ) ) 
colSelect.Add( new IDOperativeByCommonID( sProductFamily, sTableName + ".Address.StreetNumber" ) ) 
colSelect.Add( new IDOperativeByCommonID( sProductFamily, sTableName + ".Address.StreetName" ) ) 
colSelect.Add( new IDOperativeByCommonID( sProductFamily, sTableName + ".Address.Suffix.Code" ) ) 
colSelect.Add( new IDOperativeByCommonID( sProductFamily, sTableName + ".Address.City" ) ) 
colSelect.Add( new IDOperativeByCommonID( sProductFamily, sTableName + ".Address.State" ) ) 
colSelect.Add( new IDOperativeByCommonID( sProductFamily, sTableName + ".Address.ZIP" ) ) 
colSelect.Add( new IDOperativeByCommonID( sProductFamily, sTableName + ".Priority.Code" ) ) 
colSelect.Add( new IDOperativeByCommonID( sProductFamily, sTableName + ".RequestType.RequestType" ) ) 
colSelect.Add( new IDOperativeByCommonID( sProductFamily, sTableName + ".RequestType.RequestDescription" ) )
colSelect.Add( new IDOperativeByCommonID( sProductFamily, sTableName + ".InitiatedDateTime" ) ) 
colSelect.Add( new IDOperativeByCommonID( sProductFamily, sTableName + ".RequestType.Category.CategoryName" ) ) 
colSelect.Add( new IDOperativeByCommonID( sProductFamily, sTableName + ".IsResolved" ) ) 
' Add to collection of orders 
' Create Schema 
Dim oLoader as SchemaLoader oLoader = 
ServerApplication.GetSchemaLoader( oServiceRequest.UserInfo.GetProvider() ) 
res = oLoader.GenerateSchemaByCommonID( sProductFamily, sTableName + ".RequestType", oSchema ) 
if 
res.IsSuccess 
then 
res= oLoader.AddToSchemaByCommonID( sProductFamily, sTableName + ".Priority", oSchema ) 
end if 
if 
res.IsSuccess 
then 
res= oLoader.AddToSchemaByCommonID( sProductFamily, sTableName + ".RequestType.Category", oSchema ) 
end if 
if 
res.IsSuccess 
then 
addr = ServerApplication.NewComponent( "Hansen.Property.Address", oServiceRequest.UserInfo ) 
res = addr.AddTablesToSchema( oLoader, sProductFamily, sTableName + ".Address", oSchema ) 
end if 
return res