cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
eka24
Super User III
Super User III

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
eka24
Super User III
Super User III

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (66,636)