Fail to assign variable name in a different scope

HI, Forum

I’m learning UiPath as of recent and came across the following failure of which message says the variable name is duplicated.

image

This errors occurs in step (2) where the reference variable is to be defined with the same name as (1).

(1) As is seen In the following logic, I used Use Excel File “Report” activity inside the Do of another Use Excel File “Acquisitions” activity, and defined “MonthReport” as a reference for the nested Use Excel File Activity

(2) In the next step, I used Use Excel File “Sales” activity and inside it, placed the another Use Excel File activity indicating the same Excel file as the referenced on in the previous step, and defined it with the same name, “MonthReport” as a reference variable.

Can anyone help?

Best regards

@hongjoo.choi

did you create a seaprate variable as well with same name?

if so please remove it…check the variables panel when you select the inner use excel file

cheers

Why do you want to reference the same excel file with same variable twice?

Hello @hongjoo.choi ,
It may be caused by using the same scope reference name for 2 different operations.
Try changing its variable name like one with “MonthReport” and another with “MonthSalesReport”

Hi @hongjoo.choi

The issue is associated with variable scope. You can not have two variable with the same name in the same scope.

Beside that, it’s not recommend have variables with the same name even in other scope. It may confuses sometimes.

The easiest way is create meaningful name for variables, for example

In your case you can create

MonthReportAquisitions for one

MonthReportSales for another

Hi @rikulsilva and all

Thank you all for your guidance.

For clarification, the variable is not something created from “CTRL+K”. It is a reference to the same excel file used inside each of “Use Excel File” activity of which flow is shown below. By nature, the reference variable doesn’t appear in the variable panel, therefor can’t change its scope by manual.

image

Each “Use Excel File” contains another “Use Excel File” inside its Do container with the same name referencing the same excel file.

Regards

Thank you for the clarification @hongjoo.choi

From your image both variables are in the body of Excel Process Scope that causes the issue, even for reference variables.

If you surround each Use Excel File activity into a Sequence, the issue wouldn’t happen

But I strongly recommended don’t have same name for variables

Cheers

Hello, i got the same issue. Can any one get the solution, please tell me.
I am used separate sequences the issue is not resolved.

Hi @hongjoo.choi

are you was able to solve the issue?

@Srilakshmi_Pamu could you share your workflow with us to better understanding?

Thks

This is from the UiPath Academy course on Excel Automation with Modern Experience. In the video of the Excel Data Consolidation exercise they use 3 Use Excel File activities and each time the “Reference as” is “MonthReport”. In the video they don’t get the error. If you try to recreate it, it gives the following error:
image

Use 3 different “Reference as” names. Then it will not give the errors

Same error, same training module.

There’s a screenshot of the video where the error is not experienced, and a screenshot of my workflow where the error is experienced. Interestingly, if I download and execute the solution, it doesn’t throw the error and is developed exactly the same as when I throw the error. How can this be? In theory, if I received the error during development the pre-configured solution should also throw the exact same error.

I’ve received several errors like this is the trainings - how should these be reported?

Perhaps the downloaded solution contains references to older dependencies that didn’t trigger the error. Regardless, the course material should be amended to reflect the newer version of UiPath in my opinion, as what’s being done in the video in that specific module isn’t best practice.

Hi @eric.bell

By default, set it to ‘Same Project’ and then change it to ‘False’ in the Excel Process Scope. It should work without any issues.

Please refer to the link for more details.

try with 2.16.1 version
image

[type or paste code here](https://academy.uipath.com/learningpath-viewer/10943/1/558281/2)

type or paste code here