Solved Environment variable name dynamic

yozart

New Member
Hello,

I have created 2 Environment variables :
* myvar_PROD
* myvar_TEST

My object is given a text as input value which will be concatenated with the environment provided.
How can I get the value of the corresponding Environment Variable ?

In this example, I'm asking for variable "myvar" and as I'm running in PROD, it should return the value of environment variable "myvar_PROD"

View attachment 2019-10-22_10-59-53.png
2019-10-22_10-59-53-png.4741


Regards,
Yozart
 
Last edited:
Hi Yozart,

I think we cannot update environment variable once its defined. So as per your requirement we cannot achieve result via environment variables.
 

yozart

New Member
No, this isn't what I want to do ! I don't want to update the value of an environment var.

I'd like to get the value of myvar_prod but without creating a data Item Environment linked to this specific environment variable. Indeed, maybe, I will need the value of another environment variable called myvar2_prod another time.

My problem is that data item needs to specify the name of the environment variable I want to use whereas I want it to be dynamic.
 
Last edited:
So to clearify; you want your environemt variable to change depending if you're running in your test environment vs your production environment?

If so that is not possible. An environment variable can't change dynamically depending on the environment it's in. You iwll have to manually change the value with a calc stage or something - Else you have to make one environment variable for production and a different environemnt variable for test.


Hope this make sense and that I understood your question correctly.
 

Amarender

Member
Hello,

I have created 2 Environment variables :
* myvar_PROD
* myvar_TEST

My object is given a text as input value which will be concatenated with the environment provided.
How can I get the value of the corresponding Environment Variable ?

In this example, I'm asking for variable "myvar" and as I'm running in PROD, it should return the value of environment variable "myvar_PROD"

View attachment 4741
2019-10-22_10-59-53-png.4741


Regards,
Yozart

Hi Yozart

As of your above example [Current Env]=PROD ok, then Using Calc Stage "[Variable Name]&"_"&[Current Env]"= "myvar_PROD" and Use Decision Stage for the above as "[Var Name For Env]=[Environment Variable 1] (i.e.,[Environmental Variable 1]='myvar_PROD'.) then the condition is TRUE and go in the YES way. if the [Var Name For Env]=myvar_TEST then the condition is FALSE and go in the NO way.

Hope you Understand and is Helpful

Thanks and Regards
Amar
 
Top