cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
aymanhassanmct
Frequent Visitor

Dynamic check box items based on selections from drop down or combo box

Hello All,

Using PowerApps,  I need to create the following entry (Update) form) and also create the ideal Excel table on OneDrive to store data entered to this form.

The form should look like this:

actual submission date 2.jpg

Each product has its corresponding countries from total 20 options, and the data that needs to be manually updated is a date for each country. So when a product item selected, the list of countries change to fit the selected product. A user needs to first select a product, then check some or all countries, and enter dates in front of selected countries, and submit this to an Excel table (To be created). Then the process repeats with the same product and Lift ID as the dates are not always available for all countries at once, or with different product or Lift ID.

The products and selected countries currently looks like this:

actual submission date 3.jpg

Where 1 means this is supported country for that specific SKU or Product. The list of checkboxes in the PowerApps form should dynamically change to the selected countries that have the value of 1 for the selected Product.

Is this possible with PowerApps? How to create the form and the table that stores the data submitted by it?

Thanks,

Ayman

 

 

 

10 REPLIES 10
v-bofeng-msft
Community Support
Community Support

Hi @aymanhassanmct :

I made a demo and don't know if it meets your needs.If you have any questions, please point out.

t3.gif

I have two tables:

Table1:

Column1Country1Counrty2Counrty3

SKU1101
SKU2001
SKU3010
SKU4111
SKU5100
SKU6010
SKU7011
SKU8101
SKU9100
SKU10000

Table2:

PropductCountryLiftIDDateCheckBox

PropductCountryLiftIDDateCheckBox
     

Step1:Add adrop down control(Dropdown3)

Item:

 

Table1.Column1

 

Step2:Add a gallery(Gallery7)

Item:

 

Filter(Split(
       If(LookUp(Table1,Column1 = Dropdown3.SelectedText.Value).Country1 = "1","Country1##") &         
       If(LookUp(Table1,Column1 = Dropdown3.SelectedText.Value).Counrty2 = "1","Counrty2##") & 
       If(LookUp(Table1,Column1 = Dropdown3.SelectedText.Value).Counrty3 = "1","Counrty3##"),
       "##"
       ),
!IsBlank(Result))

 

Step3:Add a Checkbox into this gallery(Checkbox1)

Step4:Add a DatePicker control into this gallery(DatePicker1)

Step5:Add a button

OnSelect:

 

ForAll(
    Gallery7.AllItems,
    Patch(
        Table2,
        Defaults(Table2),
        {
            CheckBox: Checkbox1.Value,
            Propduct: Dropdown3.SelectedText.Value,
            Date: DatePicker1.SelectedDate,
            Country: Result
        }
    )
)

 

When the user presses this button, new records will be added to Table2 one by one.

Best Regards,

Bof

 

Looks good. I am testing it.

This will not post any data about unchecked countries. Right?

Hi @aymanhassanmct :

If so,you shoud set the button's OnSelect property to:

 

ForAll(
    Filter(Gallery7.AllItems,Checkbox1.Value),
    Patch(
        Table2,
        Defaults(Table2),
        {
            CheckBox: Checkbox1.Value,
            Propduct: Dropdown3.SelectedText.Value,
            Date: DatePicker1.SelectedDate,
            Country: Result
        }
    )
)

Best Regards,

Bof

Thank you again Bof, I found out that I have more than 20 countries in the actual data.

Is there any simplified code instead of using If in the items filter in the gallery?

Thank you again.

Ayman

Hi @aymanhassanmct :

I am afraid there is no way to simplify the code. Because "country" is a field name, but there is no way to get the field name through a formula.

Although the formula is a bit ugly, it is easier to operate without extensive modification.

Bet Regards,

Bof

The items code looks fine but the country option does not appear with each checkbox. I think I missed something critical. Please help.

 

countrynames.jpg

 

Hi @aymanhassanmct :

Please add a label control into this gallery and set it's text proeprty to:

dropdown.SelectedText.Value

Best Regards,

Bof

Thank you sir,

This code populated the selected value from the above box.

I need to shoe the country name which is the column header in this table.

 

actual submission date 3.jpg

 

Results now are (Option), I need tha labels of the checkboxes in the gallery reflect the countries in this table with the values of 1 for the selected SKU

 

Regards,

Up Up

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

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (31,274)