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

Not able to submit data to collection using combobox inside gallery

I added combobox control inside gallery and then patched the data in collection, data get stored in collection but doesn't show up in gallery, it adds only blank row, for now i have added checkbox but that isn't sufficient. as shown in picture below.

 

 

Annotation 2019-11-01 002625.gif

 

Is there any way i can use combobox inside gallery to save data in collections?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Not able to submit data to collection using combobox inside gallery

Hi @aman_varama ,

Could you please share a bit more about the formula you typed within the Items property of the ComboBox inside your Gallery?

Do you want to select IncidentGroup value from the ComboBox1 inside your Gallery?

 

Based on the screenshot that you mentioned, I think it is not necessary to add a ForAll function to achieve your needs. You just need to modify your formula as below:

Patch(
       CollIncident,
       ThisItem,
       {
          Id: lblCustomID.Text,
          IncidentGroup: ComboBox1.Selected.Value,    /* <-- reference value from the ComboBox1 rather than Radio control */
          IncidentCategory: txtIncidentCategory.Text,
          ShowSaveButtons: false
       }
);
If(
   EditPressed,
   false,
   Collect(
           CollIncident,
           {
             Id: "",
             IncidentGroup: "",
             IncidentCategory: "",
             ShowSaveButtons: true
           }
   )
);
UpdateContext({EditPressed: false});

 

In addition, if you want the saved IncidentGroup value to be shown up within the ComboBox1, please consider set the DefaultSelectedItems property of the ComboBox1 to following:

{
  Value: ThisItem.IncidentGroup
}

If the Items property of the ComboBox1 set to a Distinct(...) formula, please consider modify above formula as below:

{
  Result: ThisItem.IncidentGroup
}

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

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

4 REPLIES 4
Community Support Team
Community Support Team

Re: Not able to submit data to collection using combobox inside gallery

Hi @aman_varama ,

Do you want to use ComboBox to collect user data, and then patch it into a Collection?

Further, could you please share more details about the Patch formula you used in your app to patch data into a Collection from your Gallery?

 

I have made a test on my side, and don't have the issue that you mentioned, please take a try with the following workaround:

6.JPG

 

5.JPG

 

7.JPG

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

Clear(CurrentStatusRecords);
ForAll(
    Gallery1.AllItems,        /* <-- Select all Gallery Items value */
    Collect(
            CurrentStatusRecords,    /* <-- Patch data into this new collection */
            {
                ProductName: Title2.Text,
                Status: ComboBox1.Selected.Value   /* <-- Reference ComboBox selected value here directly */
            }
    )
)

The above formula execution reault as below:

8.JPG

 

Please consider take a try with above solution, then check if the issue is solved. Also please check if you have typed proper Patch formula and ForAll formula in your app to achieve your needs.

 

Please also check and see if the response I made within the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/Help-Need-to-save-textbox-data-into-...

 

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

ForAll function

Patch function

 

Best regards,

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.
aman_varama
Level: Powered On

Re: Not able to submit data to collection using combobox inside gallery

@v-xida-msft  Thank you for the response,

 

I have combobox inside gallery, and on click of plus (+) button i am trying to submit the item in collection, surprisingly, it adds the item in collection but doesn't show up in control in another row. below is another imageAnnotation 2019-11-01 002625.gif

 

i am using this formula..

 

Patch(
CollIncident,
ThisItem,
{
Id: lblCustomID.Text,
IncidentGroup: redoIncidentGroup.Selected.Value,
IncidentCategory: txtIncidentCategory.Text,
ShowSaveButtons: false
}
);
If(
EditPressed,
false,
Collect(
CollIncident,
{
Id: "",
IncidentGroup: "",
IncidentCategory: "",
ShowSaveButtons: true
}
)
);
UpdateContext({EditPressed: false});

----------------------------------------------------

 

Also when i am using the code you suggested is throwing this error

 

issue.png

 

what am i doing wrong here?

 

Thank you 

Community Support Team
Community Support Team

Re: Not able to submit data to collection using combobox inside gallery

Hi @aman_varama ,

Could you please share a bit more about the formula you typed within the Items property of the ComboBox inside your Gallery?

Do you want to select IncidentGroup value from the ComboBox1 inside your Gallery?

 

Based on the screenshot that you mentioned, I think it is not necessary to add a ForAll function to achieve your needs. You just need to modify your formula as below:

Patch(
       CollIncident,
       ThisItem,
       {
          Id: lblCustomID.Text,
          IncidentGroup: ComboBox1.Selected.Value,    /* <-- reference value from the ComboBox1 rather than Radio control */
          IncidentCategory: txtIncidentCategory.Text,
          ShowSaveButtons: false
       }
);
If(
   EditPressed,
   false,
   Collect(
           CollIncident,
           {
             Id: "",
             IncidentGroup: "",
             IncidentCategory: "",
             ShowSaveButtons: true
           }
   )
);
UpdateContext({EditPressed: false});

 

In addition, if you want the saved IncidentGroup value to be shown up within the ComboBox1, please consider set the DefaultSelectedItems property of the ComboBox1 to following:

{
  Value: ThisItem.IncidentGroup
}

If the Items property of the ComboBox1 set to a Distinct(...) formula, please consider modify above formula as below:

{
  Result: ThisItem.IncidentGroup
}

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

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

aman_varama
Level: Powered On

Re: Not able to submit data to collection using combobox inside gallery

@v-xida-msft Thank you, that solved my issue, much appreciated....

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,063)