
Dear Makers
I have 2 Dataverse tables, the one being a lookup for the other one. Here is an example:
Table 1: OpenCastReports
Field 1: Name
Field 2: OpenCastMaterial (this is a lookup for the second table)
Table 2: OpenCastMaterial
Field 1: Name
Field 2: ValueLevel
Field 3: SequenceNo
The following function filters the Dateverse table directly and returns the correct results, i.e. it returns a few records:
Filter(
OpenCastReports,
Name = "Some name here",
OpenCastMaterial.ValueLevel = 100
)
Problem: However, when I create a collection from the Dataverse table first, then I get no results returned:
ClearCollect(colOpenCastReports, OpenCastReports);
Filter(
colOpenCastReports,
Name = "Some name here",
OpenCastMaterial.ValueLevel = 100
)
Upon further Investigation I tried out a Sum() function on the Collection's OpenCastMaterial.ValueLevel field and see if a value come through. Strangely, the result is = "Blank". I guess this is the same behavior with the Filter() on the Collection above.
Sum(
colOpenCastReports,
OpenCastMaterial.ValueLevel
)
However, when Summing the OpenCastMaterial.ValueLevel field directly from Dataverse table I get the correct result.
Sum(
OpenCastReports,
OpenCastMaterial.ValueLevel
)
I can't run a filter on the Dateverse table directly as I need the collection (colOpenCastReports) to eventually Patch() the records in the table later.
Any help will be greatly appreciated!
Hi @SytzeVisser,
I've seen similar issues with lookups on other tables too.
Would copying both tables into local collections before performing joins / lookups work, as per the following code?:
ClearCollect(colOpenCastReports, OpenCastReports);
ClearCollect(colOpenCastMaterials, OpenCastMaterials);If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Connect with me online.