So I have an expression in my menu. I am wanting to apply conditional formatting

In my menu I have a role id. My statement is:

If(GetUsersRole(GetUserId()) = "No Role Found", set the font color: red)


Not sure if I am entering the syntax incorrectly or what. 

I also tried 

"color: " + If(GetUsersRole(GetUserId()) = "No Role Found","red","")


I also tried naming the expression as RoleEx:

If(GetUsersRole(GetUserId()) = "No Role Found", set RoleEx.Id text: red)

Hi Aaron !

I think this is what you need.

Regards 

Graça

Okay why am I receiving a Warning on my equal sign in my expression?


Aaron Sweatt wrote:

In my menu I have a role id. My statement is:

If(GetUsersRole(GetUserId()) = "No Role Found", set the font color: red)


Not sure if I am entering the syntax incorrectly or what. 

I also tried 

"color: " + If(GetUsersRole(GetUserId()) = "No Role Found","red","")


I also tried naming the expression as RoleEx:

If(GetUsersRole(GetUserId()) = "No Role Found", set RoleEx.Id text: red)

Hello Aaron,

Can you please share the module (oml file) to try to help you?

Or send some scrrenshots.


Thanks.


Br,

Luis


Hi again,


What is the return of the action GetUsersRole?

If it returns an boolean value, you should do this:

For expression in Table: If(GetUsersRole(GetUserId()), "", "No Role Found")

For style (CSS) in Extended Property: If(GetUsersRole(GetUserId()), "", "color: red;")


Can you try this?


Hello Aaron, 

What does the function/action GetUsersRole return? The warning should be because you are comparing the output of it with a text/string.

What does the text in the warning says?

Luis