# Reuse GlobalVariable inside Profile

**URL:** <https://forum.katalon.com/t/reuse-globalvariable-inside-profile/34298>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [October 8, 2019, 8:31am UTC](https://forum.katalon.com/t/reuse-globalvariable-inside-profile/34298 "2019-10-08T08:31:25Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![luca\_bottoni](https://avatars.discourse-cdn.com/v4/letter/l/ea5d25/32.png) [@luca\_bottoni](https://forum.katalon.com/u/luca_bottoni)\
**Post date:** [October 8, 2019, 8:31am UTC](https://forum.katalon.com/t/reuse-globalvariable-inside-profile/34298/1 "2019-10-08T08:31:25Z")

</div>

Hi,  
i have create different profile, but it’s possibile inside the same profile reuse some variable?

example?

 ![immagine](https://europe1.discourse-cdn.com/katalon/original/2X/2/287f074f45b298b7b3d474897911b3409ba1d55d.png)

this is the script

```
<?xml version="1.0" encoding="UTF-8"?>
<GlobalVariableEntities>
   <description></description>
   <name>default</name>
   <tag></tag>
   <defaultProfile>true</defaultProfile>
   <GlobalVariableEntity>
      <description></description>
      <initValue>'http://localhost:8080'</initValue>
      <name>host</name>
   </GlobalVariableEntity>
   <GlobalVariableEntity>
      <description></description>
      <initValue>'${GlobalVariable.host}/login'</initValue>
      <name>url_login</name>
   </GlobalVariableEntity>
</GlobalVariableEntities>

```

---

<div class="post-metadata">

**Author:** ![Ibus](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@Ibus](https://forum.katalon.com/u/Ibus)\
**Post date:** [October 8, 2019, 9:34am UTC](https://forum.katalon.com/t/reuse-globalvariable-inside-profile/34298/2 "2019-10-08T09:34:14Z")

</div>

i don’t think it is possible.  
what do you want to achieve?

you can have a variable for host and one for endpoint/path and build the final url in the testcase by concatenating them

---

<div class="post-metadata">

**Author:** ![luca\_bottoni](https://avatars.discourse-cdn.com/v4/letter/l/ea5d25/32.png) [@luca\_bottoni](https://forum.katalon.com/u/luca_bottoni)\
**Post date:** [October 8, 2019, 10:29am UTC](https://forum.katalon.com/t/reuse-globalvariable-inside-profile/34298/3 "2019-10-08T10:29:34Z")

</div>

thansk for your answer. yes i can and now i do it, but i have in same web application about 30 endpoint and 90% begin with the same host.

try to image this scenario, we have 30 endpoint and we have 4 machines and each machine have one profile…it’s very hard mantain this profiles scenario

profile\_1  
host=http://localhost  
url\_login=http://localhost/login

…

profile\_4  
host=http://192.168.1.4  
url\_login=http://192.168.1.4/login

---

<div class="post-metadata">

**Author:** ![HeleneB](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/heleneb/32/2775_2.png) [@HeleneB](https://forum.katalon.com/u/HeleneB)\
**Post date:** [October 8, 2019, 11:44am UTC](https://forum.katalon.com/t/reuse-globalvariable-inside-profile/34298/4 "2019-10-08T11:44:51Z")

</div>

Why not call `${GlobalVariable.host}/login` on your test case/keywords instead of `GlobalVariable.url_login` ?

---

<div class="post-metadata">

**Author:** ![luca\_bottoni](https://avatars.discourse-cdn.com/v4/letter/l/ea5d25/32.png) [@luca\_bottoni](https://forum.katalon.com/u/luca_bottoni)\
**Post date:** [October 8, 2019, 11:59am UTC](https://forum.katalon.com/t/reuse-globalvariable-inside-profile/34298/5 "2019-10-08T11:59:29Z")

</div>

sorry Helen, i not understand you. The problem is not use global var in test case, but in profile. see the first image.

`GlobalVariable.url_login` it’s not resolved in test case if i try use `${GlobalVariable.host}`/login in profile composition

---

<div class="post-metadata">

**Author:** ![Ibus](https://avatars.discourse-cdn.com/v4/letter/i/e9a140/32.png) [@Ibus](https://forum.katalon.com/u/Ibus)\
**Post date:** [October 8, 2019, 12:02pm UTC](https://forum.katalon.com/t/reuse-globalvariable-inside-profile/34298/6 "2019-10-08T12:02:11Z")

</div>

@luca_bottoni that’s why you have to plan carefully your project approach before is too late 🙂

now … have fun with find/replace  
or … just pass the full string to the url\_login variable if profiles to edit are less than testacases.  
and next time think twice and do it once

---

<div class="post-metadata">

**Author:** ![HeleneB](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/heleneb/32/2775_2.png) [@HeleneB](https://forum.katalon.com/u/HeleneB)\
**Post date:** [October 8, 2019, 12:33pm UTC](https://forum.katalon.com/t/reuse-globalvariable-inside-profile/34298/7 "2019-10-08T12:33:57Z")

</div>

> [@luca\_bottoni](#):
>
> sorry Helen, i not understand you. The problem is not use global var in test case, but in profile. see the first image.

I see, but it’s impossible.  
Create 30 endpoints times 4 profiles (120 GlobalVariables !!) when the only change is the host is not the best idea. In my opinion, your 30 GlobalVariables for endpoints are useless, because you can directly call `${GlobalVariable.host}/something` on your test case

---

<div class="post-metadata">

**Author:** ![luca\_bottoni](https://avatars.discourse-cdn.com/v4/letter/l/ea5d25/32.png) [@luca\_bottoni](https://forum.katalon.com/u/luca_bottoni)\
**Post date:** [October 8, 2019, 12:55pm UTC](https://forum.katalon.com/t/reuse-globalvariable-inside-profile/34298/8 "2019-10-08T12:55:02Z")

</div>

ok, how can you do it in this screen?

 ![immagine](https://europe1.discourse-cdn.com/katalon/original/2X/d/de4ac3caef330dec6048a5aa4d6edb6dbd7be61e.png)

---

<div class="post-metadata">

**Author:** ![Gerard\_van\_der\_Winke](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/gerard_van_der_winke/32/22419_2.png) [@Gerard\_van\_der\_Winke](https://forum.katalon.com/u/Gerard_van_der_Winke)\
**Post date:** [October 8, 2019, 1:08pm UTC](https://forum.katalon.com/t/reuse-globalvariable-inside-profile/34298/9 "2019-10-08T13:08:28Z")

</div>

Use the Value Type=Binary

 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/2/227e6697fd223e4aed5e4883d9db6a06ebd9b89c.png)

---

<div class="post-metadata">

**Author:** ![HeleneB](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/heleneb/32/2775_2.png) [@HeleneB](https://forum.katalon.com/u/HeleneB)\
**Post date:** [October 8, 2019, 1:18pm UTC](https://forum.katalon.com/t/reuse-globalvariable-inside-profile/34298/10 "2019-10-08T13:18:14Z")

</div>

Or switch in script view and set `navigateToUrl(GlobalVariable.host + "/login")` or `navigateToUrl("${GlobalVariable.host}/login")`

---

<div class="post-metadata">

**Author:** ![luca\_bottoni](https://avatars.discourse-cdn.com/v4/letter/l/ea5d25/32.png) [@luca\_bottoni](https://forum.katalon.com/u/luca_bottoni)\
**Post date:** [October 8, 2019, 1:25pm UTC](https://forum.katalon.com/t/reuse-globalvariable-inside-profile/34298/11 "2019-10-08T13:25:35Z")

</div>

![immagine](https://europe1.discourse-cdn.com/katalon/original/2X/f/f449cb7873a350a3f7d44568c2bb4cf684f35f65.png)

yeah, this work fine!!

Great Gerard\_van\_der\_Winke…fantastic
