cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Adding data from a dropdown and textinput into a table

I would like to select items from a dropdown and insert data from a text-input then with the click of a button append the items into a table on the app. This data will be held within the app until it is pushed to SQL with another button.  The table will need to hold an indefinite amount of values. 

Table 1Table 1

However, I'm having trouble figuring out how to make the app hold dynamic data in a table for me until I'm ready to publish the information to SQL. 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Adding data from a dropdown and textinput into a table

Kindly follow these steps:
1. Insert a Button and OnSelect of the Button, Create a collection, say "MyTableCollect":
  ClearCollect(MyTableCollect,{ 'Product Name': " ", Dose: " "} )

2. Use the Name of the Collection "MyTableCollect" as the Datasource of the DataTable

3. Insert Another button and use this formula OnSelect to Collect the entries on the form into  MyTableCollect:

   Collect(MyTableCollect { 'Product Name': Dropdown1.Selected.Value, Dose: Textbox1.Text} )

 Replace the dropdown1 and Textbox1 with the actual  names on your form

   

4. Finally when you are ready to Patch:

ForAll(MyTableCollect,

Patch(
'[dbo].[TableName]',Defaults('[dbo].[TableName]'),
{ColumnName1: 'Product Name',
ColumnName2: Dose}))

 

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

1 REPLY 1
Highlighted
Community Champion
Community Champion

Re: Adding data from a dropdown and textinput into a table

Kindly follow these steps:
1. Insert a Button and OnSelect of the Button, Create a collection, say "MyTableCollect":
  ClearCollect(MyTableCollect,{ 'Product Name': " ", Dose: " "} )

2. Use the Name of the Collection "MyTableCollect" as the Datasource of the DataTable

3. Insert Another button and use this formula OnSelect to Collect the entries on the form into  MyTableCollect:

   Collect(MyTableCollect { 'Product Name': Dropdown1.Selected.Value, Dose: Textbox1.Text} )

 Replace the dropdown1 and Textbox1 with the actual  names on your form

   

4. Finally when you are ready to Patch:

ForAll(MyTableCollect,

Patch(
'[dbo].[TableName]',Defaults('[dbo].[TableName]'),
{ColumnName1: 'Product Name',
ColumnName2: Dose}))

 

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,896)