I have the following nested IF statement:
If(varHR=true||varIntranetAdmin=true,If(varENF=true||varBSD=true||varTRN=true,DisplayMode.View),DisplayMode.Edit)
The variable varENF = true according to the label I created for testing but it returns DisplayMode.Edit. I want some fields to be read-only depending upon login group. Any help is much appreciated.
Solved! Go to Solution.
try this:
if((varIntranetAdmin || varHR) && (varContractHM && IsBlank(EmployeeType)), DisplayMode.Edit,DisplayMode.View)
I hope this resolved your issue if you see any challenge let me know I am always happy to help.
Regards,
Krishna
If this post helps give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.
@KrishnaV Again, thank you. For anyone coming to this for a solution, for me I needed to replace the && with || (in red font below)between first two conditions and the second:
If((varHR||varIntranetAdmin)||(varContractHM && IsBlank(EmployeeType)),DisplayMode.Edit,DisplayMode.View)
What are the values of varHR and varIntranetAdmin?
Hi @IntraAdmin ,
The if the syntax is wrong because a boolean variable need not to be validated as varHR=true, try the below see the result as needed:
If(varHR||varIntranetAdmin,
If(varENF||varBSD||varTRN,DisplayMode.View)
,DisplayMode.Edit)
As per the logic you written, how it works is: if varHR or VarIntranetAdmin is true then it will further validate for varEnf or varBSD or VarTRN to be true to show the label in view mode if not it will show as edit mode.
By the way, I am assuming that you are writing this formula at DisplayMode property of the input text control.
I hope this resolved your issue if you see any challenge let me know I am always happy to help.
Regards,
Krishna
If this post helps, then please consider Accept it as the solution and give thumbs-up to help the other members find it more.
@Jeff_Thorpe My value for varENF is true
varIntranetAdmin is false
varHR is false
@KrishnaV Thank you for your help. That formula did not work. I have it in the DisplayMode property but also tried it in Default.
Both formulas are allowing edits. When I set a label to MyDataCardValue.DisplayMode it is returning blank (not with Edit or View).
UPDATE: The DisplayMode is showing Edit no matter who is logged in.
The formula is written, so that if varIntranetAdmin is false and varHR is false then DisplayMode.Edit
DisplayMode.View will only happen if (varIntranetAdmin or varHR is true) and (varEN or varBSD or varTRN are true).
Hi @IntraAdmin ,
I see these are the below variables in the formula, if you could tell me the business logic like when you want the field to edit mode and when you want it to display mode:
varHR,varIntranetAdmin,varENF, varBSD, varTRN
Let me know I am always happy to help.
Regards,
Krishna
If logged in User() is in AAD group then set varX to true.
So if varIntranetAdmin is true then every other variable will be false. If this is the case, then set DisplayMode.Edit.
If varHR is true then every other variable will be false. If this is the case, then set DisplayMode.Edit,
ELSE If varENF is true, then every other variable will be false. If this is the case, then set DisplayMode.View,
If varTRN is true, then every other variable will be false. If this is the case, then set DisplayMode.View,
If varENF is true, then every other variable will be false. If this is the case, then set DisplayMode.View,
If varITD is true, then every other variable will be false. If this is the case, then set DisplayMode.View,
If varBSD is true, then every other variable will be false. If this is the case, then set DisplayMode.View,
If varHirMgr is true, then every other variable will be false. If this is the case, then set DisplayMode.View,
Also, If varContractHM is true and EmployeeType is blank, then every other variable will be false. If this is the case, then set DisplayMode.Edit,
My logic on getting logins and setting tabs is working. I am not sure why I am getting so hung up on this.
Thank you both for your help!
try this:
if((varIntranetAdmin || varHR) && (varContractHM && IsBlank(EmployeeType)), DisplayMode.Edit,DisplayMode.View)
I hope this resolved your issue if you see any challenge let me know I am always happy to help.
Regards,
Krishna
If this post helps give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.