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

Help! Need to save textbox data into collection

Hi all,

 

Currently I have a Gallery that is populated by a Collection with existing data, and I have some additional text boxes and dropdowns/combo boxes which I added in to the gallery. 

The issue is I am having is I am unsure as to how I can have data that is being manually inputed through a textbox/dropdown to be saved into its associated item on the gallery, and thus also be saved into the collection. 

 

Any help will be greatly appreciated.

 

Cheers!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Help! Need to save textbox data into collection

Hi @swan_soup,

Could you please share a screenshot about your app's configuration?

Do you add corresponding columns within your Collection to store the value inputted through a Textbox/Dropdown control?

If you have added corresponding columns within your Collection to store the value inputted through a Textbox/Dropdown control, I have made a test on my side, please take a try with the following workaround:4.JPG

 

5.JPG

My Collection data (MyBuildingInfo) as below:6.JPG

Set the Items property of the Gallery control (Gallery1) to following:

MyBuildingInfo

Set the OnSelect property of the "SAVE" button to following:

ForAll(
    RenameColumns(Gallery1.AllItems,"BuildingName","BuildingName1"),    /* <-- BuildingName represents the Distinct column in my Collection (MyBuildingInfo) */
    Patch(
        MyBuildingInfo,
        LookUp(MyBuildingInfo, BuildingName=BuildingName1),
        {
            DropdownValue: Dropdown1.Selected.Value,
            TextBoxValue: TextInput1.Text
        }
    )
)

On your side, you should type:

ForAll(
    RenameColumns(Gallery1.AllItems,"ColumnName","ColumnName1"),   /* <-- ColumnName represents the Distinct column in your Collection */
    Patch(
        MyBuildingInfo,
        LookUp(MyBuildingInfo, ColumnName= ColumnName1),
        {
            DropdownColumn: Dropdown1.Selected.Value,    /* DropdownColumn represents the column in your Collection, which used to store the Dropdown value in your Gallery*/
            TextBoxColumn: TextInput1.Text             /* TextBoxColumn represents the column in your Collection, which userd to store the TextBox value in your Gallery*/
        }
    )
)

More details about the ForAll function and RenameColumns function, please check the following article:

ForAll function

RenameColumns

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Help! Need to save textbox data into collection

Hi @swan_soup,

Are you trying to add a new record to your collection or edit an existing row by adding some new fields? If it is the latter, you will need to use the Patch() function to do it.  Also, Patching a collection will not produce a permanent change in the data source underlying the collection and any changes will be lost when the app is closed unless the collection is saved back to the data source. . 

Community Support Team
Community Support Team

Re: Help! Need to save textbox data into collection

Hi @swan_soup,

Could you please share a screenshot about your app's configuration?

Do you add corresponding columns within your Collection to store the value inputted through a Textbox/Dropdown control?

If you have added corresponding columns within your Collection to store the value inputted through a Textbox/Dropdown control, I have made a test on my side, please take a try with the following workaround:4.JPG

 

5.JPG

My Collection data (MyBuildingInfo) as below:6.JPG

Set the Items property of the Gallery control (Gallery1) to following:

MyBuildingInfo

Set the OnSelect property of the "SAVE" button to following:

ForAll(
    RenameColumns(Gallery1.AllItems,"BuildingName","BuildingName1"),    /* <-- BuildingName represents the Distinct column in my Collection (MyBuildingInfo) */
    Patch(
        MyBuildingInfo,
        LookUp(MyBuildingInfo, BuildingName=BuildingName1),
        {
            DropdownValue: Dropdown1.Selected.Value,
            TextBoxValue: TextInput1.Text
        }
    )
)

On your side, you should type:

ForAll(
    RenameColumns(Gallery1.AllItems,"ColumnName","ColumnName1"),   /* <-- ColumnName represents the Distinct column in your Collection */
    Patch(
        MyBuildingInfo,
        LookUp(MyBuildingInfo, ColumnName= ColumnName1),
        {
            DropdownColumn: Dropdown1.Selected.Value,    /* DropdownColumn represents the column in your Collection, which used to store the Dropdown value in your Gallery*/
            TextBoxColumn: TextInput1.Text             /* TextBoxColumn represents the column in your Collection, which userd to store the TextBox value in your Gallery*/
        }
    )
)

More details about the ForAll function and RenameColumns function, please check the following article:

ForAll function

RenameColumns

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 92 members 3,342 guests
Please welcome our newest community members: