cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lennova
Helper I
Helper I

Update all items in a gallery

Hi all,

 

I have a SP list called 'Task' containing items and a lookup column called ParentTask linked to the ID column in the same 'Task' list.

What I want to achieve is basically users to link certain items together to 1 masteritem. Sort of like a sub-task within a larger task.

 

I have a gallery "galLinkItems" filtering the items from my SP list so the gallery contains possible sub-tasks for the larger task and in the gallery I have a combobox / checkbox for each item in the gallery for when the user wants to link the item as a sub-task to the larger task.

 

The larger task is displayed in a form called frmTaskSchedule so my larger task ID is in there.

 

I assume i need to use ForAll and Patch but i can't get it to work.

 

Any help would be greatly appreciated.

 

Thanks!

Hans

1 ACCEPTED SOLUTION

Accepted Solutions
Lennova
Helper I
Helper I

Solved!

 

Below did the trick. My ParentTask column in my SP list was a lookup column. I have re-created the column as a number and now it all works.

 

ForAll(
Filter( galSubTask.AllItems,
cbSubTask.Value = true
),
Patch( Task,
LookUp( Task, ID = Value(lblSubID.Text) ),
{ ParentTask: Value(lblMainID.Text) }
)
)

View solution in original post

5 REPLIES 5
Sunil-Narnaware
Super User
Super User

@Lennova : how are you plan to link the sub-task with main task.? what I mean here is... are you using Combobox or Checkbox (If checkbox, how user will know which task it should be assigned to?) .. Combobox I can understand that it can be list of tasks which don't have task ID assigned hence these are parent tasks and then on selection of it.. we can patch it.. but can you share more insights on the approach you would like to take..? also the use of Form ?

Hi Sunil,

 

I have a screen where a form displays details of the main task. On that same screen I have a gallery where possible sub-tasks are displayed. In that gallery i have a checkbox for each sub-task.

 

User will turn checkbox to on when they want to link the main task to that sub-task. User will click a save button that will patch the main task ID in the parenttask column in my SP list when the checkbox for that specific sub-task has been checked.

Sunil-Narnaware
Super User
Super User

@Lennova.. what is the Item property of your Form? how are you selecting you Main task?

Hi Sunil,

 

The main task is selected in a gallery on a different screen. So, my form is populated with the ID of the task.

Lennova
Helper I
Helper I

Solved!

 

Below did the trick. My ParentTask column in my SP list was a lookup column. I have re-created the column as a number and now it all works.

 

ForAll(
Filter( galSubTask.AllItems,
cbSubTask.Value = true
),
Patch( Task,
LookUp( Task, ID = Value(lblSubID.Text) ),
{ ParentTask: Value(lblMainID.Text) }
)
)

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,668)