Hi All,
I have made a job card application, Basically, it has 2 SharePoint lists. 1 is the primary list with client details and 2nd list holds items provided and details about those items.
On the selection of the gallery item, it will clear the collection ColJCItems and set the Gallery.Selected.ID to a Variable, and on a button, it collects the items for the given job card.
The button that shows Code:
Clear(COLJCITEMS); Set( JobCardID, GALJobCards.Selected.ID ); ClearCollect( JCJobCard, First( Filter( 'Job Cards', ID = JobCardID ) ) ); ForAll( Filter( 'Job Card Items', Title = Text(JobCardID) ), Collect( COLJCITEMS, Last( FirstN( AddColumns( 'Job Card Items', "RowNumber", CountRows(COLJCITEMS) + 1 ), CountRows(COLJCITEMS) + 1 ) ) ) ); Set( EditV, false ); Set( TimeV, false ); Set( ItemsV, false ); Set( InformationV, false ); Set( SignV, false ); Set( HTMLView, true )
Now the collection is returning the Items I am looking for as well as the first Item in the SharePoint list. I can confirm the Item Title field (Job cards ID's) are not equal to the ID of the job card.
The Gallery label "on select" property is:
Clear(COLJCITEMS);Set(JobCardID,ThisItem.ID);Set(HTMLView, false );Set(EditV, false );Set(TimeV, false );Set(ItemsV, false );Set(SignV, false );Set(InformationV, true )
I am clearing the COLJCITEMS twice to try and remove the added item. but nothing is working.
If I just have a button clear the collection and then go view the collection, it is empty. however on collect, it returns the wrong data.
any assistance is appreciated. please let me know if you need anything further.
thank you
Solved! Go to Solution.
Hi All
So there is an issue with the for all function doing a collect as if I do a basic collect it works perfectly every time. code below:
Clear(COLJCITEMS); Set( JobCardID, GALJobCards.Selected.ID ); ClearCollect( JCJobCard, First( Filter( 'Job Cards', ID = JobCardID ) ) ); Collect( COLJCITEMS, Filter( 'Job Card Items', Title = Text(JobCardID) ) ); Set( EditV, false ); Set( TimeV, false ); Set( ItemsV, false ); Set( InformationV, false ); Set( SignV, false ); Set( HTMLView, true )
I don't know why it would not apply the filter on the records while for all was there however it was only there to give me a row number for my items on the list.
After taking row numbers out it works fine. a bit disappointed but what can you do.
Comparison of changed code:
Before: ---------------------- ForAll( Filter( 'Job Card Items', Title = Text(JobCardID) ), Collect( COLJCITEMS, Last( FirstN( AddColumns( 'Job Card Items', "RowNumber", CountRows(COLJCITEMS) + 1 ), CountRows(COLJCITEMS) + 1 ) ) ) ) --------------------------------- After: --------------------------------- Collect( COLJCITEMS, Filter( 'Job Card Items', Title = Text(JobCardID) ) )
Thanks for the support
Hi @SnowFlake ,
Could you describe more clearly about "If I just have a button clear the collection and then go view the collection, it is empty. however on collect, it returns the wrong data. "?
Do you mean that the Clear function do not work?
Actually, I haven't quite understand your issue.
Best regards,
Hi @v-yutliu-msft
I trust you well, I should have sent screenshots in the last post 🙂
The collection that holds child records
now the code for the button that collects data
Clear(COLJCITEMS); Set( JobCardID, GALJobCards.Selected.ID ); ClearCollect( JCJobCard, First( Filter( 'Job Cards', ID = JobCardID ) ) ); ForAll( Filter( 'Job Card Items', Title = Text(JobCardID) ), Collect( COLJCITEMS, Last( FirstN( AddColumns( 'Job Card Items', "RowNumber", CountRows(COLJCITEMS) + 1 ), CountRows(COLJCITEMS) + 1 ) ) ) ); Set( EditV, false ); Set( TimeV, false ); Set( ItemsV, false ); Set( InformationV, false ); Set( SignV, false ); Set( HTMLView, true )
Sharepoint items
Title is ID of Jobcard
I dont know if this will help but it works first time perfectly when the app starts up. after you select different a different gallery item (Job card) it seems to stop doing the filter on the for all function. Thus why I assumed it was not clearing the collection from the first run.
I then thought maybe its the gallery not updating the job card id to a variable. but I can confirm that it goes and fetches the correct job card parent using the Set(JobCardId, gallery.selected.id)
I made a button to clear the collection and even when the app collects to an empty collection it still fetches the wrong child items.
Im really stumped here as from what I can see it works the first time it runs so the code is correct. its almost like not all the code is running again.
if you would like me to send screenshots of it working on start I can?
Thank you for your support
Hi All
So there is an issue with the for all function doing a collect as if I do a basic collect it works perfectly every time. code below:
Clear(COLJCITEMS); Set( JobCardID, GALJobCards.Selected.ID ); ClearCollect( JCJobCard, First( Filter( 'Job Cards', ID = JobCardID ) ) ); Collect( COLJCITEMS, Filter( 'Job Card Items', Title = Text(JobCardID) ) ); Set( EditV, false ); Set( TimeV, false ); Set( ItemsV, false ); Set( InformationV, false ); Set( SignV, false ); Set( HTMLView, true )
I don't know why it would not apply the filter on the records while for all was there however it was only there to give me a row number for my items on the list.
After taking row numbers out it works fine. a bit disappointed but what can you do.
Comparison of changed code:
Before: ---------------------- ForAll( Filter( 'Job Card Items', Title = Text(JobCardID) ), Collect( COLJCITEMS, Last( FirstN( AddColumns( 'Job Card Items', "RowNumber", CountRows(COLJCITEMS) + 1 ), CountRows(COLJCITEMS) + 1 ) ) ) ) --------------------------------- After: --------------------------------- Collect( COLJCITEMS, Filter( 'Job Card Items', Title = Text(JobCardID) ) )
Thanks for the support
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
185 | |
53 | |
41 | |
36 | |
30 |
User | Count |
---|---|
241 | |
74 | |
71 | |
69 | |
65 |