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

Visible based on two possible values

Hopefully this is a fairly simple one for someone but I cant get my head round it.

 

I have a pop up (PopUpThreeQuotes) where I have set its Visible property to: ShowPopUpThreeQuotes

I also have a data card (ThreeQuotes) and set its Visible property to: ShowThreeQuotes

 

I have built it so when the toggle AnnualOrder is set to true the Pop Up and Data Card will be made visible

If(
    AnnualOrder.Value = UpdateContext({ShowThreeQuotes: false}), 
    UpdateContext({ShowThreeQuotes: true}) & UpdateContext({ShowPopUpThreeQuotes: true})
);

 

The pop up has a button whose OnSelect turns the visible property of the pop up to false: UpdateContext({ShowPopUpThreeQuotes:false})

 

This all works as I would like.

 

I am trying to add in if a data card (TotalCost) has a value > 999.99 then the same actions happen as above.

Value(TotalCost.Text) > 999.99,

 

The pop up and data card needs to be visible if either condition is met they are not dependant. But I need to be able to remove the pop up and keep the data card.

 

Many thanks

3 REPLIES 3
hantsjoel
Resolver II
Resolver II

Hi @StewG,

 

How about this for a method...

 

As the datacard is entirely dependent on the toggle being true or the value of TotalCost being above 999.99, use this formula for the Visible property of the DataCard:

AnnualOrder.Value Or Value(TotalCost.Text) > 999.99

 

Then you can control the visibility of the popup with one variable.

 

Set the OnCheck property of the toggle to:

UpdateContext({ShowPopUpThreeQuotes: true})

 

Set the OnUncheck property of the toggle to:

UpdateContext({ShowPopUpThreeQuotes: false})

 

Set the Visible property of the popup to:

ShowPopUpThreeQuotes

 

And finally the button OnSelect property to:

UpdateContext({ShowPopUpThreeQuotes: false})

 

Hope that works for you!

hantsjoel
Resolver II
Resolver II

Sorry @StewG, there is one piece missing - triggering ShowPopUpThreeQuotes to true when the label has a value > 999.99

 

Is there some sort of event that you could place this formula on?

If(Value(TotalCost.Text)>999.99, UpdateContext({ShowPopUp: true}))

Perhaps the OnVisible of the screen, or the OnSelect of an item in a gallery?

 

StewG
Helper I
Helper I

Hi @hantsjoel 

 

The formulas for triggering the pop up with the Annual Order toggle work great.

The issue I am still struggling with is getting the pop up to show when the below formula is used.

 

If(Value(TotalCost.Text)>999.99, UpdateContext({ShowPopUpThreeQuotes: true}))

I have tried placing it in the screens OnVisible and in the OnSelect of other items in the gallery which are mainly dropdowns. I have even tried putting it in the OnSelect of the navigation button on the previous screen, but no luck.

Its a real head scratcher!

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,542)