cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kgordish
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
v-xiaochen-msft
Community Support
Community Support

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
v-xiaochen-msft
Community Support
Community Support

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
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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (58,056)