Hi All,
I am new to canvas apps and I still trying to understand how Collection works.
first, let me explain the task I want to achieve:
I have a canvas app that uses Dataverse as a data source, in the dataverse there is a table called: Challenge Participants simply it creates a manual relationship between 2 entities: Athlete and Challenges. so it has M-1 relationship with both entities.
athletes(which are contacts in dataverse) need to access 2 screens from the canvas app:
1. Active challenges that they have not enrolled in yet.
2. Active challenges that they have enrolled in.
both screens will be simple screens showing a gallery for each filtered record.
for 1st screen, the filter is:
Distinct(Filter('Challenge Participants','Athlete '.Contact<>First(currentAthlete).Contact && Challenge.'Status Reason'='Status Reason (Challenges)'.Active),Challenge)
the 2nd screen :
Filter('Challenge Participants','Athlete '.Contact=First(currentAthlete).Contact && Challenge.'Status Reason'='Status Reason (Challenges)'.Active)
the problem is with 1st screen, I believe the filter is wrong, at least I have to store it in a collection lets call it: activeChallengeParticipants and by somehow process it to REMOVE its item if it is in the myActiveChallengeParticipants
I assumed that is the only way here, so I created in the app start these 2 collections, and i desperately tried to achieve this approach with no success, i tried things like removeIf and like using a temp collection
but i think the issue is that when i create these filters into collections, the columns of the lookup fields (which are athlete and challenge) is created as tables inside the collection table, and i do not know how to access it, it is not accessible through the "dot"
here is how i create the collection:
ClearCollect(
myActiveChallengeParticipants,
Filter(
'Challenge Participants',
'Athlete '.Contact = First(currentAthlete).Contact && Challenge.'Status Reason' = 'Status Reason (Challenges)'.Active
)
);
and this is how to appears in the table:
i tried to follow this structure: RemoveIf(Collection2, Not(ID in Collection1.ID))
but in my case i could not access the collection lookup fields, so:
RemoveIf(activeChallengeParticipants, Not(activeChallengeParticipants[@ap_Challenge].Challenge in myActiveChallengeParticipants[@ap_Challenge]));
>> but this throw error:
so i tried:
my questions are:
1. is using collections and processing it to delete the active participant if it was in my active participants collection is the correct approach?
2. if yes, how can i do that?
3. how can i generally access lookup field into a collection? as it appears to be saved as a table inside a table?
thank you all!

Report
All responses (
Answers (