Data Infrastructure Management Software Discussions

variables usable for each command

berhei

Hello

 
is there a way to declare and define a variable (e.g. $Username) which can be used in every command of a workflow without using it as user input?
 
Thanks and best regards
berhei
6 REPLIES 6

Re: variables usable for each command

sinhaa

This feature of global user inputs is not available in WFA as yet. But you can do it by a workaround by defining a function that returns the value of the Parameter that you would want.

---

def param (username)
{
return "sinhaa";
}

----

 

Now you can call this fuction in any workflow in any command parameter.

 

 

sinhaa

 

 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Re: variables usable for each command

berhei

Thank you sinhaa.

 

This solves one problem 🙂

Is there any way I can set the username and retrive it later?

 

Best regards.

 

Re: variables usable for each command

sinhaa

Ahh.. you need to give clear details about what exactly are you trying to do. These one liners riddles will not help me give an accurate answer.

 

Kindly explain what are you looking to achieve with some degree of detail.  

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Re: variables usable for each command

berhei

@sinhaa wrote:

Ahh.. you need to give clear details about what exactly are you trying to do. These one liners riddles will not help me give an accurate answer.

 

Kindly explain what are you looking to achieve with some degree of detail.  


 

Ok sorry, I'll do my best.

 

I need a variable (e.g. $VolumeName) which is accessible the same way a user input is accessible. E.g. in a Filter or another query.

The workaround with the function will work when I want to receive the value of $VolumeName.

 

So during run time of the Workflow I want to compute the value for $VolumeNameand set $VolumeName to the computed value. E.g. Using a Query.

And then I want to use the value of $VolumeNamein a Filter.

 

So the question is how can I declare set $VolumeName and access it in such an "semi-global" way?

 

I am hoping this explains enough. Thank you in advance.

Re: variables usable for each command

trentino123

You can also use a CONSTANT.

 

In the Setup->Constants .

 

That is not a user input, fixed for every command in the workflow.

 

Whenever you change that constant value, the input on every command will refer to the new value.

 

So you always use the constant names in the command, but you change the value only once.

 

Hope that helps.

Re: variables usable for each command

sinhaa

No, sorry I still didn't get it. Give some clear example.

 

The function denifinition gives you a global contant, they can be used in filters, command parameters anywhere and in any workflow. 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
Earn Rewards for Your Review!
GPI Review Banner
All Community Forums
Public