# Assign a condition in a string tag and use in an expresion tag

**URL:** <https://forum.inductiveautomation.com/t/assign-a-condition-in-a-string-tag-and-use-in-an-expresion-tag/62340>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [July 27, 2022, 10:18am UTC](https://forum.inductiveautomation.com/t/assign-a-condition-in-a-string-tag-and-use-in-an-expresion-tag/62340 "2022-07-27T10:18:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francisco\_Armengol\_C](https://avatars.discourse-cdn.com/v4/letter/f/d9b06d/32.png) [@Francisco\_Armengol\_C](https://forum.inductiveautomation.com/u/Francisco_Armengol_C)\
**Post date:** [July 27, 2022, 10:18am UTC](https://forum.inductiveautomation.com/t/assign-a-condition-in-a-string-tag-and-use-in-an-expresion-tag/62340/1 "2022-07-27T10:18:24Z")

</div>

Hi everyone, I’m Paco Armengol, I’m from Spain.  
I want to ask a question to the Inductive automation community.  
I want to make a button visible or not based on the user’s role. So far correct, but when there are many roles and buttons it becomes difficult to maintain it.  
I had thought about the condition Ejem…“”“”" (if(hasRole(“quality”) || hasRole(“Administrator”) || hasRole(“Supervisor”)|| hasRole(“Director@”)|| hasRole(“DevelopmentProduct”)), true, false) )“”“”“”", put it in a tag and then from the visible property of the buttons call this tag. In this way, if I want to add a new role, I only have to do it in one place, in the tag that will contain the string with the condition.  
Does anyone know how to do it?

Thank you very much

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 27, 2022, 11:09am UTC](https://forum.inductiveautomation.com/t/assign-a-condition-in-a-string-tag-and-use-in-an-expresion-tag/62340/2 "2022-07-27T11:09:08Z")

</div>

Hi Paco, and welcome!

I think you just answered your own question, but we can simplify it a little. 🙂 The following expression will return true / false without needing the ‘if’ statement.

```auto
    hasRole('quality')
 || hasRole('Administrator')
 || hasRole('Supervisor')
 || hasRole('Director@') 
 || hasRole('DevelopmentProduct')
   

```

Alternatively, you can also set security on individual components.  
[https://docs.inductiveautomation.com/display/DOC79/Component+and+Window+Security](https://docs.inductiveautomation.com/display/DOC79/Component+and+Window+Security)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 27, 2022, 11:34am UTC](https://forum.inductiveautomation.com/t/assign-a-condition-in-a-string-tag-and-use-in-an-expresion-tag/62340/3 "2022-07-27T11:34:10Z")

</div>

> [@Francisco\_Armengol\_C](#):
>
> will contain the string with the condition

No, you cannot compile expressions at runtime.
