cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ing_Jesus_Lopez
Frequent Visitor

checkbox and datatable

Hello, I have a data table with two columns called tech skill, id and a gallery with the tech skill checkbox, I want to insert the value of each checkbox checked in my database and show the selected skills in my datatable

4 REPLIES 4
Silvester
Continued Contributor
Continued Contributor

How does your database look like? Do you have a column for each one of those skills in your DB?
You need to load all the checkbox elements inside a collection that loads anytime the app is started. So you set this on the OnStart 

ClearCollect(ColName,[".Net",....,"Java"])

Then you have another collection for all the elements that are being checked against. So on the checkbox Oncheck property, Set this 

Collect(Checked,ThisItem.Value)

Then on your save button, add this

ForAll(Checked,Patch(DataSource,Defaults(DataSource),{Skills: ThisItem.Value}))

You could also twerk it to make it suit your process.

If you find this post interesting, give it a like and accept it as a solution to help others find it

Hello Silvester, my database is a relation database, in this case, the skill values is a catalog, this table have a 3 columns, idskill, cve and description, in my gallery show the description but i should insert in another table only the skill id.

 

Best regards

Silvester
Continued Contributor
Continued Contributor

Alright, @Ing_Jesus_Lopez ,
Assuming you are loading the skills checkboxes from the catalog, do this.

You need to have another collection for all the elements that are being selected. So on the checkbox's Oncheck property, Set this 

Collect(Checked,ThisItem.Value)

Then on your save button, add this to the OnSelect Property

ForAll(Checked,Patch(DataSource,Defaults(DataSource),{Skills: ThisItem.Value}));Clear(Checked)

 

Ing_Jesus_Lopez
Frequent Visitor

Hello, i have a new issue when insert the information, the issue is because repeat autoincrement column in my table when apply the patch function. How to insert increment values for each checked checkbox.

 

Regards

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,933)