cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

ComboBox, SharePoint Choice Column, and IF Then Statement

Hello,

I have 2 ComboBoxes. 
Data Source is a SharePoint Choice Field. 

 

Trying to write an IF Then Statement, but having issues.
Part of me suspects it is  due to the "Complex" column issue. 

Essentially trying to write if "Not Required" Selected then "Not Required" or Selected Item Value

Combobox20 and ComboBox21


Default for Combobox21
IF(DataCardValue20.Selected.Value = "Not Required", "Not Required","DataCardValue21.Selected.Value")

Learning the intricacies of complex columns is frustrating at times.  
Any insight?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Microsoft
Microsoft

Hi @kgordish ,

 

Could you tell me:

  1. Are Combobox20 and DataCardValue20 the same control?
  2. Are Combobox21 and DataCardValue21 the same control?
  3. Do you want when Combobox20 control selects Not Required, Combobox21 control will display Not Required by default?
  4. Do you want when Combobox20 control doesnt select Not Required, Combobox21 control will display the first option by default ?

 

If my assumptions are correct, the point is to use the DefaultSelectedItems property of the combo box control.

 

I've made a test for your reference:

1\ This is my list LIST31.

v-xiaochen-msft_0-1607912730964.png

 

v-xiaochen-msft_1-1607912730965.png

 

 

2\ Set the DataCardValue21s DefaultSelectedItems property to:

If(DataCardValue20.Selected.Value="Not Required",{Value:"Not Required"},First(Choices(LIST31.ComboBox21)))

 

3\ The result is as follows:

v-xiaochen-msft_2-1607912730968.png

 

v-xiaochen-msft_3-1607912730970.png

 

 

Best Regards,

Wearsky

View solution in original post

Follow Up. 

I had issues with formula above. Previously saved data was not showing in the app.

After trial and error this formula works. 

If(DataCardValue20.Selected.Value="Not Required",{Value:"Not Required"}, (ThisItem.'Name of SharePoint Column'))

View solution in original post

3 REPLIES 3
Microsoft
Microsoft

Hi @kgordish ,

 

Could you tell me:

  1. Are Combobox20 and DataCardValue20 the same control?
  2. Are Combobox21 and DataCardValue21 the same control?
  3. Do you want when Combobox20 control selects Not Required, Combobox21 control will display Not Required by default?
  4. Do you want when Combobox20 control doesnt select Not Required, Combobox21 control will display the first option by default ?

 

If my assumptions are correct, the point is to use the DefaultSelectedItems property of the combo box control.

 

I've made a test for your reference:

1\ This is my list LIST31.

v-xiaochen-msft_0-1607912730964.png

 

v-xiaochen-msft_1-1607912730965.png

 

 

2\ Set the DataCardValue21s DefaultSelectedItems property to:

If(DataCardValue20.Selected.Value="Not Required",{Value:"Not Required"},First(Choices(LIST31.ComboBox21)))

 

3\ The result is as follows:

v-xiaochen-msft_2-1607912730968.png

 

v-xiaochen-msft_3-1607912730970.png

 

 

Best Regards,

Wearsky

View solution in original post

@v-xiaochen-msft 
Thank you for the clue. The formula I am using below seems to work just fine. 

I was editing default instead of defaultselecteditems.

 

kgordish_0-1607952785863.png

Left: Combobox20; Right: Combobox21

Instead of First(Choices...) I used Defaults formula. That way the default for ComboBox21 was not set to "Not Required" when ComboxBox20 had nothing selected due to the First Choice. 

 

I used If(DataCardValue20.Selected.Value="Not Required",{Value:"Not Required"},Defaults('Test Drop Down'.Function_Status))

Follow Up. 

I had issues with formula above. Previously saved data was not showing in the app.

After trial and error this formula works. 

If(DataCardValue20.Selected.Value="Not Required",{Value:"Not Required"}, (ThisItem.'Name of SharePoint Column'))

View solution in original post

Helpful resources

Announcements
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

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

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Kudoed Authors
Users online (19,167)