Hi experts,
I have gone through all the documentation on web I could find for this Collection.Where(filter), but I am still unable to achieve what I want in my custom ABSL script.
My requirement is as below :
Need to fetch all the details from Utilities Premise BO and display them in my custom GAF by concatenating address in one field.
Source BO Screen :

My target Screen looks like this :

Now as you can see I have successfully made query to the UtilitiesPremise BO and got the 4 records I wanted, But it seems that the address details which get back on query are present under an association name HierarchyRelationship.
I have right now used HierarchyRelationship.GetFirst() and I am filling the same address for all the premises right now.
Now in the data model I see that this 'HierarchyRelationship' has [0-1] cardinality so actually it shouldn't be a collection in the first place. But for some reason it is.
I found that inside this Collection there is a common field named ExtenalID present at the "root of query response" and other one under "HierachyRelationship - >UpperInstallationPoint" [the premise ID in this case] which I can leverage to search among this collection to fetch using where that only give me those records whos external ID matches with the one in root.
But I am unable to write this into code for some reason. I am using where for the first time. No clue how to use it. But I found some docs and syntax in blogs also but It's returning me 0 records so I am doing something wrong.
Kindly have a look at my code below:
var res = UtilitiesPremise.QueryByObjectIdMapping.Execute(); //Returns 4 rec
MoveIn.Search.QueryByElements.Execute().Delete(); //CustomBO node Search clr
if(res.Count()!= 0)
{
foreach(var item in res)
{
var searchtable : elementsof MoveIn.Search;
////My try to fetch using where() -> returned 0 entries.
//var address = res.ToInstallPoint.HierarchyRelationship.Where(n => n.ExternalID.content == item.ExternalID.content).UpperInstallationPoint.AddressInformation.Address.DefaultPostalAddressRepresentation;
//Using GetFirst() for the time being
var address = res.ToInstallPoint.HierarchyRelationship.GetFirst().UpperInstallationPoint.AddressInformation.Address.DefaultPostalAddressRepresentation;
var house = address.HouseID;
var street = address.StreetName;
var city = address.CityName;
var country = address.CountryCode;
var pincode = address.StreetPostalCode;
var state = address.RegionCode.content;
searchtable.PremiseAddress = house +", "+ street +" St. "+ city +", "+ country +" "+ pincode;
searchtable.ServiceDetails = "Electric, Gas";
searchtable.PremiseNumber = item.ExternalID.content.RemoveLeadingZeros();
searchtable.PremiseType = item.PremiseTypeCode;
searchtable.Instalno1 = item.ToInstallPoint.ID.content;
searchtable.State = state;
//searchtable.ConnectionObject = item.ToInstallPoint.HierarchyRelationship;
searchtable.Owner = "Mandy Scneo" ;
searchtable.CurrentCust = "John Paul";
this.Search.Create(searchtable);
}
}
now I am doing something wrong here?
Please guide me I am stuck badly. Also let me know if you need any more information to help me.
Any help would be appreciated.
Regards,
Akash