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

Combine two IF conditions in one button in DisplayMode

Hi, I really need your help on how can I combine these two conditions in PowerApps DisplayMode. I tried to combine these two (refer no 2 in the screenshot), and it returns no error but when I published my app, the button cannot be clicked and saved the data. Really appreciate your help

 

Condition 1: If(DataCardValue38.Text="Not Processed",DisplayMode.Disabled,DisplayMode.Edit)

 

Condition 2: If(And(IsBlank(Datefrom.SelectedDate) || IsBlank(DataCardValue34.SelectedItems.DisplayName) || IsBlank(DataCardValue35.SelectedItems.DisplayName)),Disabled)

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RiccoHipp1903
Resolver II
Resolver II

I would try this 

If(
 DataCardValue38.Text="Not Processed",
 DisplayMode.Disabled,
  If(And(IsBlank(Datefrom.SelectedDate) || IsBlank(DataCardValue34.SelectedItems.DisplayName) || IsBlank(DataCardValue35.SelectedItems.DisplayName)),
   Disabled,
   Edit)
)

View solution in original post

4 REPLIES 4
RiccoHipp1903
Resolver II
Resolver II

I would try this 

If(
 DataCardValue38.Text="Not Processed",
 DisplayMode.Disabled,
  If(And(IsBlank(Datefrom.SelectedDate) || IsBlank(DataCardValue34.SelectedItems.DisplayName) || IsBlank(DataCardValue35.SelectedItems.DisplayName)),
   Disabled,
   Edit)
)
v-qiaqi-msft
Community Support
Community Support

Hi @Nbz78,

Do you want to disable the button when either of the condition is met or both of them are met?

 

I think your issue is related to the validation of the DataCardValue34.SelectedItems and DataCardValue35.SelectedItems.

 

Since SelectedItems is a Table value, you should use the IsEmpty() function instead of the IsBlank() function.

If you want to disable the button once either of the condition is met:

If(
 DataCardValue38.Text="Not Processed" ||
 (And(IsBlank(Datefrom.SelectedDate) || IsEmpty(DataCardValue34.SelectedItems.DisplayName) || IsEmpty(DataCardValue35.SelectedItems.DisplayName)),
   Disabled,
   Edit)
)

If you want to disable the button once both of the conditions are met:

If(
 DataCardValue38.Text="Not Processed" &&
 (And(IsBlank(Datefrom.SelectedDate) || IsEmpty(DataCardValue34.SelectedItems.DisplayName) || IsEmpty(DataCardValue35.SelectedItems.DisplayName)),
   Disabled,
   Edit)
)

 

Best Regards,
Qi

Hi thank you for your help! 🙂 I tried your code and everything seems good. Will let you know if I encounter any issues on this

Thanks for helping!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,105)