Learning platform
Automation developer training
Description
Unable to use the same variable twice. But the video uses the same variable without changing the syntax
Link
Date
2000-11-07
Related UiPath products
Studio
Automation developer training
Unable to use the same variable twice. But the video uses the same variable without changing the syntax
2000-11-07
Studio
There must be variable scope differences. Open the Variables panel and change the variable scope to higher level.
Like this:
Documentation here for reference.
I am not sure how to edit the scope to change it to a higher level. Can you inform me on how to go about that?
Delete one of the duplicate variable dt_Report and then change the scope like this. lower in the dropdown, higher will be the scope means you can use the variable in all the activities throughout that scope and in between.

I don’t know how to send a video like you did, but after deleting one of the variables I still only have two options to choose from under the scope column.
If you are going to have single dt_Report, change its scope to `Main sequence’ and should be fine.
@brixt.macharia
Remove one of the duplicate variables, dt_Report, and adjust its scope to the main sequence. This will allow it to be accessible throughout the workflow
remove the ‘dt_Report’ variable in the 2nd row.
I deleted the duplicate and changed the single dt_report scope to the main sequence. I saved and then ran the project but still received an error.
Would you be able to share the code here to check?
The error saying you haven’t configured the column name to be filtered. Click on Configure filter button and give the filter conditions.
Variable is found and available
I had a few minor errors that kept the automation from running successfully but I resolved the issue. Thank you for your time.
It seems I have run into the same issue on my next project this time the issue is simply due to not being able to use the same variable twice. I have yet to finish the project because of this error.
What does clicking the “Remove Unused” do exactly? Because I need to use the same variable twice but currently I am unable to.
The error says you have a variable with same name already in the same scope.
So instead of d declaring again, just use the variable.
Remove Unused will remove any variable which is declared but not used in any activity or expression.
Hi @brixt.macharia ,
It will remove the duplicate variables from your code and if you want to reuse the same variable, then try changing the scope of the same variable.
BR,
NK
In the course that I am following along to build this project I don’'t see where they declared the variable, so I have just been typing in the specific variable in the appropriate place