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

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
Highlighted
Community Support
Community Support

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

Hi @Anonymous ,

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
Highlighted
Community Support
Community Support

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

Hi @Anonymous ,

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-collection/m-p/179951

 

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.
Highlighted
Anonymous
Not applicable

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 

Highlighted
Community Support
Community Support

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

Hi @Anonymous ,

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

Highlighted
Anonymous
Not applicable

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
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 (6,441)