# Nested Variables to use in all types of variables, how? key: FQDN value: {{host}}.{{domain}}

**URL:** <https://community.postman.com/t/nested-variables-to-use-in-all-types-of-variables-how-key-fqdn-value-host-domain/5002>\
**Category:** Help Hub\
**Tags:** variables\
**Created:** [April 15, 2019, 6:16pm UTC](https://community.postman.com/t/nested-variables-to-use-in-all-types-of-variables-how-key-fqdn-value-host-domain/5002 "2019-04-15T18:16:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrick.weichmann](https://avatars.discourse-cdn.com/v4/letter/p/9de0a6/32.png) [@patrick.weichmann](https://community.postman.com/u/patrick.weichmann)\
**Post date:** [April 15, 2019, 6:16pm UTC](https://community.postman.com/t/nested-variables-to-use-in-all-types-of-variables-how-key-fqdn-value-host-domain/5002/1 "2019-04-15T18:16:28Z")

</div>

I’m trying to build a collection with many different folders and trying to make use of global and environment variables in order to use them in many places and run the collection for a few different environments.

But I fail to understand and fail to use variables that use variables themselves as values, e.g.

name = abc  
first name = pete  
host = machine1  
domain = [dot.com](http://dot.com)  
…

And then I want to use as the URL for the get a variable that is combined, e.g.

https://{{FQDN}}/

which I would like to define in global environment variables as:

FQDN = {{host}}.{{domain}}

How to do this?

---

<div class="post-metadata">

**Author:** ![matt](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/matt/32/2562_2.png) [@matt](https://community.postman.com/u/matt)\
**Post date:** [April 15, 2019, 6:47pm UTC](https://community.postman.com/t/nested-variables-to-use-in-all-types-of-variables-how-key-fqdn-value-host-domain/5002/2 "2019-04-15T18:47:15Z")

</div>

You could add the following to the Pre-Request Script of your first request, or even build out a “Setup” folder as the first thing to execute.

You’ll need to set this programmatically as the environment editor takes plain text only.

```auto
const host = pm.environment.get("host");
const domain = pm.environment.get("domain");
pm.environment.set("fqdn", `${host}.${domain}`);

```
