How to use Assign Activity?

Hi Folks
Good Morning,
My question is :
I have two variable
1.Name = True
2.Name =(value) XYZ.
if the first variable is True Than I have to change Value in my workflow.
So, My Idea is…
First I will create two Assign variable one for True and another for the name and pass those value in a workflow is it right? or anyone has any good suggestion for that?
I have around 50 to 55 variable for this.

Any suggestion for that it would be a great help.
Thanks in Advance.
Happy Learning

Regards,
Ankur

Hi @ankur1984.

Check this

JsonString = JsonString.Replace(“{true}”,YourVariable0).Replace(“{xyz}”,YourVariable1)
Or string.format(json_data,value1,value2)

Thanks
Ashwin.S

Thanks @AshwinS2 Can you please explain me in details. i have around 50 to 55 variable only for this. may be i will get this value from queue.

Thanks Again

Ankur

Hi @ankur1984

Pass these variable through a dictionary

Thanks
Ashwin S

1 Like

Thanks @AshwinS2 But i have 45 to 50 variable can you please explain me in details ?

Regards,
Ankur

Hi @ankur1984,
Your question is absolutely unclear. The title “Basic Knowledge” is also too vague.

Please read this How to ask a good question? before you ask again.

Cheers

1 Like

Thanks @J0ska for your valuable time i appreciate that.

Regards,
:slightly_smiling_face:
Ankur

Not at all. Still not clear what the question is about.

The Assign activity is described here https://docs.uipath.com/activities/docs/assign
or here https://docs.uipath.com/activities/docs/multiple-assign
Working with variables is described here Managing Variables

But given your “Robot Master” badge I would expect you know all this.

Cheers

Is simple i will get two value from Work queue. i am using JSOn File.
so
one is (True) & Second (XYZ)
If first one is true then i have to change value to XYZ
How can i do it?

Ankur

You can do this through a decision, this is the easiest solution. You send the firs variable “One = True” as an argument, and in the second workflow, you can use a flow decision activity (if you use flowchart) or a if activity (if you have a sequence) where you check the value of variable “One”. in the decision statement, if value of var “One” is true → then variable “TWO” is “XYZ” else, do nothing.

If you need additional information, please let me know,
Bianca

Hi @bianca Thank you for you time, I appreciate that.
i knew this solution,
But i have around 50 to 55 same type of value. so every time i have to use if activity or flow decision activity.
Any new suggestion for this ?

Regards,

Ankur

If it is the same variable that you check and there are 50 different values you should assign for it, you can try a Switch activity and as a main variable, you use the one that must be checked, and for each case you set a different value.

Hi @bianca Thank you again, i have 50 different value like Name, Surname, Id Card. , Email, Contact no. and so on… Can you please explain me with example ?.in details.

Regards,
Ankur

I understand now, and where do you have all this variables stored? If they are in an array or in a datatable, you can use a for each loop and when a value is found true, you replace it with a specific value

Hi @bianca those all value i will get from API. and make a Dictionary and Deserialize them.
So my question is for each value i have to make two variable is it ? one for true and another for value.

Regard,
Ankur

Yes, if the values are different you have to treat them individually

ok @bianca so we don’t have any option. :roll_eyes: Once again Thank you for your time.

Regards,
Ankur

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.