Power Apps Community,
I have two SharePoint lists that are connected by IDs that track a time entry and an associated tag in the Title column:
TimeEntries.ID = TimeEntryTags.TimeEntryID
I have a created collections for both of these lists using the same date filters where VarUserName is the Full Name of the user and StartTimeAsNumber is the date as a number in yyyymmdd format:
ClearCollect(EntriesCol1, Filter(TimeEntries, Title = VarUserName, StartTimeAsNumber >= Value(FilterByStartDateInput_1.Text)));
ClearCollect(TagsCol1, Filter(TimeEntryTags, 'Full Name' = VarUserName, StartTimeAsNumber >= Value(FilterByStartDateInput_1.Text)));
Next, I want to create a new collection which has the Tag associated with the TimeEntry.
ForAll(EntriesCol1, Collect(EntriesWithTagCol2, {TimeID: ID, Tag: LookUp(TagsCol1, TimeEntryID = ID).Title}));
For some reason, the Title column of TagsCol1 does not transfer to the new collection EntriesWithTagCol2.
I can use a gallery to display EntriesCol1 and then use a LookUp in a Label to get the associated tag in the Title column:
Label.Text within Gallery = LookUp(TagsCol1, TimeEntryID = ThisItem.ID).Title
I can also hard code labels with the matching IDs to get the Title column:
LookUp(TagsCol1, TimeEntryID = 118).Title
Why can I not get the ForAll(EntriesCol1 statement to work with the LookUp to get the Title column from TagsCol1?
I would really appreciate some help. I've spent a lot of time banging my head against a wall trying to figure this out.
Thank you!
Solved! Go to Solution.
Try altering your formula to the following:
ForAll(
AddColumns(EntriesCol1, "id", ID),
Collect(EntriesWithTagCol2, {TimeID: id, Tag: LookUp(TagsCol1, TimeEntryID = id).Title})
);
I hope this is helpful for you.
Try altering your formula to the following:
ForAll(
AddColumns(EntriesCol1, "id", ID),
Collect(EntriesWithTagCol2, {TimeID: id, Tag: LookUp(TagsCol1, TimeEntryID = id).Title})
);
I hope this is helpful for you.
Can you try to update the expression to:
ForAll(EntriesCol1, Collect(EntriesWithTagCol2, {TimeID: ID, Tag: LookUp(TagsCol1, TimeEntryID = ThisRecord.ID).Title}));
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
ThisRecord is nice to use, but be cautious with it - it has some unexpected results.
@RandyHayes
That worked great! Any idea why I couldn't use the ID field from the List? There must be something special about it that wouldn't allow it to work.
In my troubleshooting I discovered some anomalies but couldn't discover the root issue.
Thanks for the help!
Good news!
It's all about ambiguity...in your first formula, you were referencing the ID of the wrong source in your Lookup.
There are things like Disambiguation notation that can be used and other objects like ThisRecord as was also mentioned, but they sometimes do not reference what you might think.
In the formula I gave you, we end up adding a totally different column and then specifically referencing that column in the LookUp - there is nothing ambiguous then, it's a totally different column than the other source.
Thanks again Randy!
For anyone else that views this thread, using RenameColumns still has disambiguation problems. That was one of my troubeshooting steps but still didn't work.
Randy's solution works great.
User | Count |
---|---|
180 | |
114 | |
88 | |
44 | |
42 |
User | Count |
---|---|
226 | |
113 | |
112 | |
69 | |
67 |