cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ccernat
Level: Powered On

Master CheckBox to select all checkboxes in gallery and put the data into a collection

Hi, community!

 

I'm on a standstill. I have the screen bellow, a gallery named Lista_Chiriasi1 a collection named Colectiebifati, a checkbox control in the gallery named CheckBox2, a checkbox control outside the gallery named Checkbox3 and a Sharepoint list.

Capture.PNG

 

1. OnVisible of the screen:

 

Clear(Colectiebifati);Set(ResetCheckbox,true);Set(ResetCheckbox,false)

 

2. User selects individually a checkbox from the gallery.

OnCheck:

 

If (ThisItem.Evaluare = 1,
Collect(Colectiebifati,{ID : ThisItem.ID,Aprobat_E:1,DataAprobarii_E:Today(),CA_E_A:ThisItem.CA_E,Bonuri_E_A:ThisItem.Bonuri_E,Controller_E:USER.Text}),
Collect(Colectiebifati,{ID : ThisItem.ID,Aprobat:1,DataAprobarii:Today(),CA_A:ThisItem.CA_R,Bonuri_A:ThisItem.Bonuri_R,Controller:USER.Text})
)

OnUncheck:

 

Remove(Colectiebifati,LookUp(Colectiebifati, ID = ListaChiriasi_1.Selected.ID))

3. User ticks CheckBox3 control - and here is where I am stuck - all the gallery checkboxes must be selected and all its items to be put, according to the formula in the OnCheck of the Checkbox2, to the collection. How do I do that? 

 

4. User presses the button, bottow right of the screen: SharePoint list name TurnOverAppsList_test to be patched with the collumns from the collection Colectiebifati. Same problem, I don't know how. 

 

Thanks alot for any hint!

2 ACCEPTED SOLUTIONS

Accepted Solutions
Mike8
Level 10

Re: Master CheckBox to select all checkboxes in gallery and put the data into a collection

Hello ccernat,

-About 3 you can try the following:
CheckBox2.Default = CheckBox3.Value

CheckBox3.OnCheck =
ForAll(Lista_Chiriasi_1.AllItems, 
If (Evaluare = 1, Collect(Colectiebifati,
{ID : ID,Aprobat_E:1,DataAprobarii_E:Today(),CA_E_A:CA_E,Bonuri_E_A:Bonuri_E,Controller_E:USER.Text}), Collect(Colectiebifati,{ID : ID,Aprobat:1,DataAprobarii:Today(),CA_A:CA_R,Bonuri_A:Bonuri_R,Controller:USER.Text}) )

)

CheckBox3.OnUnCheck =
ForAll(Lista_Chiriasi_1.AllItems,
Remove(Colectiebifati,LookUp(Colectiebifati, ID = Colectiebifati[@ID]))

)


-About 4 I am not sure.
Do the collection Colectiebifati and sharepoint list have the same column names?
If yes, can you try the following expression? 
Button1.OnSelect = Collect(SharePointListName,Colectiebifati)  

View solution in original post

Highlighted
Mike8
Level 10

Re: Master CheckBox to select all checkboxes in gallery and put the data into a collection

Please change CheckBox3.OnCheck to:

CheckBox3.OnCheck =
ForAll(Filter(Lista_Chiriasi_1.AllItems,!(ID in Colectiebifati.ID)), 
If (Evaluare = 1, Collect(Colectiebifati,
{ID : ID,Aprobat_E:1,DataAprobarii_E:Today(),CA_E_A:CA_E,Bonuri_E_A:Bonuri_E,Controller_E:USER.Text}), Collect(Colectiebifati,{ID : ID,Aprobat:1,DataAprobarii:Today(),CA_A:CA_R,Bonuri_A:Bonuri_R,Controller:USER.Text}) )
)
in order to avoid adding twice the same record in the collection.

About 4: Yes there is. If you check the community you will find a way to do it. If you can't, you can post here and I can try to help you.
You can use this as a reference
https://powerusers.microsoft.com/t5/General-Discussion/Insert-new-entry-into-SharePoint-list/td-p/65...

View solution in original post

3 REPLIES 3
Mike8
Level 10

Re: Master CheckBox to select all checkboxes in gallery and put the data into a collection

Hello ccernat,

-About 3 you can try the following:
CheckBox2.Default = CheckBox3.Value

CheckBox3.OnCheck =
ForAll(Lista_Chiriasi_1.AllItems, 
If (Evaluare = 1, Collect(Colectiebifati,
{ID : ID,Aprobat_E:1,DataAprobarii_E:Today(),CA_E_A:CA_E,Bonuri_E_A:Bonuri_E,Controller_E:USER.Text}), Collect(Colectiebifati,{ID : ID,Aprobat:1,DataAprobarii:Today(),CA_A:CA_R,Bonuri_A:Bonuri_R,Controller:USER.Text}) )

)

CheckBox3.OnUnCheck =
ForAll(Lista_Chiriasi_1.AllItems,
Remove(Colectiebifati,LookUp(Colectiebifati, ID = Colectiebifati[@ID]))

)


-About 4 I am not sure.
Do the collection Colectiebifati and sharepoint list have the same column names?
If yes, can you try the following expression? 
Button1.OnSelect = Collect(SharePointListName,Colectiebifati)  

View solution in original post

ccernat
Level: Powered On

Re: Master CheckBox to select all checkboxes in gallery and put the data into a collection

God sent! Thanks a bunch!!

 

At point 4: Only the specific columns from the collection must have their corresponding records updated in the Sharepoint list. The sharepoint list has many more columns, but it includes the exact same columns from the collection too.

 

It is a way to specify only those columns?

 

Tks alot!

Highlighted
Mike8
Level 10

Re: Master CheckBox to select all checkboxes in gallery and put the data into a collection

Please change CheckBox3.OnCheck to:

CheckBox3.OnCheck =
ForAll(Filter(Lista_Chiriasi_1.AllItems,!(ID in Colectiebifati.ID)), 
If (Evaluare = 1, Collect(Colectiebifati,
{ID : ID,Aprobat_E:1,DataAprobarii_E:Today(),CA_E_A:CA_E,Bonuri_E_A:Bonuri_E,Controller_E:USER.Text}), Collect(Colectiebifati,{ID : ID,Aprobat:1,DataAprobarii:Today(),CA_A:CA_R,Bonuri_A:Bonuri_R,Controller:USER.Text}) )
)
in order to avoid adding twice the same record in the collection.

About 4: Yes there is. If you check the community you will find a way to do it. If you can't, you can post here and I can try to help you.
You can use this as a reference
https://powerusers.microsoft.com/t5/General-Discussion/Insert-new-entry-into-SharePoint-list/td-p/65...

View solution in original post

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Kudoed Authors
Users Online
Currently online: 286 members 5,616 guests
Please welcome our newest community members: