I am trying to set a fields viable depending on if a toggle is true,
If the first part its if toggle 1 is true to set value P to true
on second toggle it is to set only C to true
but if both toggles are true to set both C and P as true
The first two parts work, its only when both are true is it not showing both P and C as true
Here is my code this is done on the select of a button.
If(Toggle2.Value, true; Set(c, false) & Set(p, true) & Set(i, false), If(Toggle1.Value, true; Set(c, true) & Set(p, false) & Set(i, false), If(Toggle1.Value, true & Toggle2.Value, true, Set(c, true) & Set(p, true) & Set(i, false))))
Solved! Go to Solution.
In this case, you can use the following formula on your next button:
If(
Toggle1.Value && Toggle2.Value = false,
Set(c,true);Set(p,false);Set(i,false),
If(
Toggle2.Value && Toggle1.Value = false,
Set(c,false);Set(p,true);Set(i,false),
If(
Toggle2.Value && Toggle1.Value,
Set(c,true);Set(p,true);Set(i,false),
Set(c,false);Set(p,false);Set(i,false)
)
)
)
Then, on all the fields that need to be visible/not visible, add the corresponding variables (c, p, i) to the Visible property. There might be an easier way with Switch, but this should do the job as well.
Is this what you'd like to achieve?
I created this by using the following formula on Toggle1:
If(
Self.Value && Toggle2.Value = false,
Set(c,true);
Set(p,false);
Set(i,false),
Self.Value && Toggle2.Value,
Set(c,true);
Set(p,true);
Set(i,false)
);
and this on Toggle2
If(
Self.Value && Toggle1.Value = false,
Set(c,false);
Set(p,true);
Set(i,false),
Self.Value && Toggle1.Value,
Set(c,true);
Set(p,true);
Set(i,false)
);
I hope this helps. Please let me know.
Should this answer help you, please mark it as a solution.
Hi @amyharkus86 ,
Try
Set(p,Toggle1.Value);
Set(c,Toggle2.Value);
Set(i,false)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @WarrenBelz your fist reply is accurate ish, i only want the visibly of these to change on button click as it then takes them to another view
On toggle1 Oncheck i have this
true & UpdateContext({varContractSub: "No"}); UpdateContext({varContractName:"Internal Transfer/Change Of Role & Contract Particulars"}); If(Toggle2.Value = true, UpdateContext({varContractName:"Internal Transfer/Change Of Role & Contract Particulars & Pay & Benefits"}))
on toggle 2 Oncheck i have this
true & UpdateContext({varContractSub: "No"}); UpdateContext({varContractName:"Internal Transfer/Change Of Role & Pay & Benfits"}); If(Toggle1.Value = true, UpdateContext({varContractName:"Internal Transfer/Change Of Role & Contract Particulars & Pay & Benefits"}))
On the button i have 'Next' on select i want to have if toggle one is selected to view 'C' fields, I have a bunch of required fields for c that are set visible = c
same for toggle two but instead p
i want to view both the fields in c and p if both toggles are true.
I dont want the change to happen on the toggle as visible on the submitted button based on these toggles, if they are both false then the submitted but is visable, if one of them is true the 'Next' button is instead visible.
So although the above works i dont want to make the change on the toggles.
In this case, you can use the following formula on your next button:
If(
Toggle1.Value && Toggle2.Value = false,
Set(c,true);Set(p,false);Set(i,false),
If(
Toggle2.Value && Toggle1.Value = false,
Set(c,false);Set(p,true);Set(i,false),
If(
Toggle2.Value && Toggle1.Value,
Set(c,true);Set(p,true);Set(i,false),
Set(c,false);Set(p,false);Set(i,false)
)
)
)
Then, on all the fields that need to be visible/not visible, add the corresponding variables (c, p, i) to the Visible property. There might be an easier way with Switch, but this should do the job as well.
Good that @FabianAckeret has solved this for you.
I have been offline for the last two days due to location.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
192 | |
95 | |
65 | |
62 | |
58 |
User | Count |
---|---|
244 | |
166 | |
91 | |
78 | |
76 |