Hi,
I would be grateful for any help on ForAll query as I have spent days looking at this and not getting very far.
i have three related dataverse tables, Animals, AnimalMedicine, and AnimalMedicineLookup.
the Animal table has a ID, Name and Diseases (multi choice).
the AnimalMedicine table has ID, AnimalMedicineLookupID (lookup), Name (lookup), MedicineDescription columns.
The AnimalMedicineLookup table has AnimalMedicineLookupID, Diseases (multi choice), MedicineDescription columns.
The aim is once a user selects a Name in the Animal gallery, they are taken to a new screen where they can view all the Medicines that are related to the diseases for their selected Animal. I need to filter the diseases of that Animal from that AnimalMedicineLookup table and then patch it into the AnimalMedicine table so I can use the data in a gallery in a new screen.
First of all I have started a collection to collection all diseases of the selected animal.
ClearCollect(colDiseases, ThisItem);
then obtained the relevant columns
ClearCollect(colDiseasesRelevant, ShowColumns, Diseases);
then I have filtered the medicines from the MedicineLookup table and then stored in a new collection.
ClearCollect(colResults, []);
ForAll(
colDiseasesRelevant,
With(
{matchedRecord: Lookup(colDiseasesRelevant, Diseases = AnimalMedicalLookup.Dieases)},
If(
Is Blank(matchedRecord),
Collect(colResults,
{AnimalMedicineLookupID: ThisRecord}
)
)
)
)
Any help would be very, very appreciated. thank you 🤩