Paragraph inner text conditional

Hi all, I need to change the text of a paragraph if a user is logged in and based on the user’s role.
How can I write a condition like this?
Do I have to use some function in the code editor?

Can you explain a bit more detailed which part of the text would you like to change conditionally and what variable exactly would you like to check?

I want to change the whole text with the following conditions:
If user is not logged in
Text 1
Else
If role = P
Text 2
If role = C
Text 3

I already have the information on the role and authentication, I just need to understand where to apply since I have never written conditions in the code

variable == 1 ? 'Text 1' : variable == 2 ? 'Text 2' : 'Text 3'

It’s ternary operator, that is used in this case.

A ok perfect, I had seen that feature but I didn’t know how to use it yet…
Thanks for the support Teodor, Wappler is amazing!!!

2 Likes

I tend to do this kind of thing on the server side if possible, using the logic in the server action to create a Set Value variable which is output and has the appropriate text as it’s value.

Thanks for the suggestion, actually with the method suggested by Teodor everything works very well and I can manage everything on the frontend without server side operations

1 Like