# Global variable that calls two other global variables?

**URL:** <https://forum.katalon.com/t/global-variable-that-calls-two-other-global-variables/55837>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [June 17, 2021, 3:32pm UTC](https://forum.katalon.com/t/global-variable-that-calls-two-other-global-variables/55837 "2021-06-17T15:32:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![parsonschandler](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/parsonschandler/32/16103_2.png) [@parsonschandler](https://forum.katalon.com/u/parsonschandler)\
**Post date:** [June 17, 2021, 3:32pm UTC](https://forum.katalon.com/t/global-variable-that-calls-two-other-global-variables/55837/1 "2021-06-17T15:32:16Z")

</div>

Variable1: employee last name  
Variable2: employee first name  
Variable3: Variable 1 + comma + Variable2

I can’t seem to get this to work using multiple syntaxes: in paranthesis, with globalvariable.variablename. Maybe this simply isn’t an option?  
If this helps, I’m trying to store these in the default profile option.

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [June 17, 2021, 7:21pm UTC](https://forum.katalon.com/t/global-variable-that-calls-two-other-global-variables/55837/2 "2021-06-17T19:21:59Z")

</div>

Global variables can’t really “call” each other, they are not functions. They are meant to be static values. I guess can you provide an example of what you are trying to do? If Variable1 and Variable2 are always the same value (which they should be), why not just hard code it?:

Variable1 = Smith  
Variable2 = John  
Variable3 = Smith, John

Better yet, just do the concatenation in your script(s):

`def lastFirst = GlobalVariables.Variable1 + ", " + GlobalVariables.Variable2`

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [June 17, 2021, 7:26pm UTC](https://forum.katalon.com/t/global-variable-that-calls-two-other-global-variables/55837/3 "2021-06-17T19:26:11Z")

</div>

You might also reference this topic I posted a while back, which lets you set up your own set of “Global Variables” that are test suite-scoped:

> [@How to pass variables between test cases in a suite (the "right" way...)](http://forum.katalon.com/t/how-to-pass-variables-between-test-cases-in-a-suite-the-right-way/40745):
>
> Hey all, I would just like to share a super simple approach to passing variables between test cases in a suite, as I’ve seen many topics over the years with questions on how to do this efficiently. To be clear, there are already several approaches to this, including, but not limited to: 1.) Creating “empty” GlobalVariables in a Profile, assigning values to those variables at runtime, then consuming them as a global variable in later scripts. This approach works fine, but in my opinion is non…

---

<div class="post-metadata">

**Author:** ![parsonschandler](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/parsonschandler/32/16103_2.png) [@parsonschandler](https://forum.katalon.com/u/parsonschandler)\
**Post date:** [June 17, 2021, 9:36pm UTC](https://forum.katalon.com/t/global-variable-that-calls-two-other-global-variables/55837/4 "2021-06-17T21:36:23Z")

</div>

I like this idea. However, I’m extremely new to programming and groovy so I’m building this strictly via manual mode. I’m assuming I have to put that statement in the script part? Does it need to go at the beginning? I’ll take a look at your linked post next. Thanks for the reply!

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [June 19, 2021, 6:11pm UTC](https://forum.katalon.com/t/global-variable-that-calls-two-other-global-variables/55837/5 "2021-06-19T18:11:04Z")

</div>

In this case, I would just define 3 global vars like I did above:

Variable1 = Smith  
Variable2 = John  
Variable3 = Smith, John
