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

Multiple If Statements to disable button

I have a page that has some yes no choices but they are not all shown and only visible depending on a dropdown selection from the previous screen.

 

I have the next button disabled currently if the values are no and the signature box has no pen input using the below formula and it works well.

If(
DataCardValue53.Value && DataCardValue54.Value && DataCardValue55.Value && DataCardValue56 && DataCardValue57.Value && Form2.Valid && Varsigcheck = DriverSig.Image,
DisplayMode.Edit,
DisplayMode.Disabled
)

 

I want to change this to be if the datacard is visbible and toggle value is yes - the next button is in edit mode

but if its not visible ignore it.

 

I tried to add an or & and statement but i cannot seem to get it to work,

If(Or('Dock Side Saftey_DataCard1'.Visible = true && DataCardValue2.Value = true And 'Dock Side Saftey_DataCard1'.Visible = false && DataCardValue2.Value = false) true, false)

 

How can i make this work?

 

Thanks in advance

 

 

3 REPLIES 3
WannaBePro
Advocate I
Advocate I

This is very confusing.

In your first example you have a bunch of datacards and DisplayMode logic.

Then you say you want to change it, but in the second, you have a bunch of different datacards and boolean logic.

And what do you mean by "ignore it"?  

What happens if the card is visible but the toggle is off?

 

Maybe take a screenshot, or draw something that shows the behaviour you're looking for, then we can figure out the logic you need.

WBP

MRBCODC
Frequent Visitor

Hi @WannaBePro  Sorry if i was not clear, i am quite new to this.

 

Yes the first formula works for the whole page - if all of the toggles have value yes and the signature box has pen input the 'next page' button is in edit mode

 

The second formula is my attempt at the formula for one data card. 

so lets ignore my attempt and start from scratch.

 

I have up to 20 data cards with yes/no values

never will all data cards be visible

 

so I would like my formula to instruct -

 

Any data cards that are visible must show a yes value 

and 

signature box must have a pen input (Varsigcheck = DriverSig.Image)

ignore - (the datacard value does not have any impact on the next button)

the no value on any data card that is not visible

 

I do not have screen shots right now as I am on my mobile.

 

Has that made my issue a bit clearer?

MRBCODC
Frequent Visitor

Managed to sort this i used a large if statement to check each data card and put an or in there to ignore it if it was not visible. 

 

Display mode = If(
('Site Specific Induction_DataCard3'.Visible=true && DataCardValue53.Value || 'Site Specific Induction_DataCard3'.Visible=false) &&
('PPE Comliance_DataCard2'.Visible=true && DataCardValue54.Value || 'PPE Comliance_DataCard2'.Visible=false) &&
('Local SSOW Issued or Availble_DataCard2'.Visible=true && DataCardValue55.Value || 'Local SSOW Issued or Availble_DataCard2'.Visible=false) &&
('Local Site Hazard Recognition_DataCard1'.Visible=true && DataCardValue56.Value || 'Local Site Hazard Recognition_DataCard1'.Visible=false) &&
('Local Fire & First Aid Points Located_DataCard1'.Visible=true && DataCardValue57.Value || 'Local Fire & First Aid Points Located_DataCard1'.Visible=false) &&
('Dock Side Saftey_DataCard1'.Visible = true && DataCardValue2.Value || 'Dock Side Saftey_DataCard1'.Visible=false) &&
(Course1_DataCard1.Visible = true && DataCardValue3.Value || Course1_DataCard1.Visible=false) &&
(Course2_DataCard1.Visible = true && DataCardValue4.Value || Course2_DataCard1.Visible=false) &&
(Course3_DataCard1.Visible = true && DataCardValue5.Value || Course3_DataCard1.Visible=false) &&
(Course4_DataCard1.Visible = true && DataCardValue6.Value || Course4_DataCard1.Visible=false) &&
(Course5_DataCard1.Visible = true && DataCardValue25.Value || Course5_DataCard1.Visible=false) &&
(Course6_DataCard1.Visible = true && DataCardValue26.Value || Course6_DataCard1.Visible=false) &&
(Course7_DataCard1.Visible = true && DataCardValue30.Value || Course7_DataCard1.Visible=false) &&
(Course8_DataCard1.Visible = true && DataCardValue31.Value || Course8_DataCard1.Visible=false) &&
(Course9_DataCard1.Visible = true && DataCardValue32.Value || Course9_DataCard1.Visible=false) &&
(Course10_DataCard1.Visible = true && DataCardValue33.Value || Course10_DataCard1.Visible=false) &&
(Course11_DataCard1.Visible = true && DataCardValue34.Value || Course11_DataCard1.Visible=false) &&
(Course12_DataCard1.Visible = true && DataCardValue35.Value || Course12_DataCard1.Visible=false) &&
(Course13_DataCard1.Visible = true && DataCardValue37.Value || Course13_DataCard1.Visible=false) &&
(Course14_DataCard1.Visible = true && DataCardValue45.Value || Course14_DataCard1.Visible=false) &&
(Course15_DataCard1.Visible = true && DataCardValue46.Value || Course15_DataCard1.Visible=false) &&
Varsigcheck = DriverSig.Image,
DisplayMode.Edit,
DisplayMode.Disabled
)

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (1,763)