Analyzer

Hi,
In REFRamework when I run Analyzer, it is showing a bunch of errors for global variables used in states. Why is that? How to remedy it?

For example, if I define TransactionNumber in Main and use it in a state, it shows as an error saying it is not decalred. It may be inaccessible.

Thank you,

Hi @A_Learner

  • Directly accessing global variables in different workflows can lead to scope-related issues and make debugging difficult.Use variables and arguments.

  • Open Main.xaml.

  • Go to the Variables panel.

  • Create a new variable named TransactionNumber and set its scope to Main.

  • Open Process.xaml.

  • Go to the Arguments panel.

  • Create an argument named in_TransactionNumber with direction In.

  • When invoking Process.xaml from Main.xaml, map TransactionNumber to in_TransactionNumber.

  • In Main.xaml, where you invoke Process.xaml, click on the Import Arguments button.

  • Map the TransactionNumber variable to in_TransactionNumber.

Hope it helps!!

@A_Learner,

Refer this article of mine.

Thanks,
Ashok :slightly_smiling_face:

Thank you, @ashokkarale
I am using version 2020.10
Global meaning, variables declared in the main workflow which are used across REFramework. Why they are shwoing error in Analyzer. Bot run is okay.

Thank you,

@A_Learner

Version 2020 dors not support global…

Now if you are saying a variable in main is global then no…it is a local variable in the main.xaml….

So if you need to access it in any other xaml then you need to create an input argument in that child xaml and then link it to the variable via imports panel in the invoke workflow in the main xaml

Hope this helps

Cheers

1 Like

@A_Learner,

Ok. So those are not global variables.

If project is running fine then, workflow analyser is showing warnings not error. If there are error then code would not have ran.

Mostly the warnings are for naming conventions. You can search the rule code in documentation for knowing it’s meaning and how to fix it.

Thanks,
Ashok :slightly_smiling_face:

Thank you, @ashokkarale
Code is running ok. But the issues are shown as Errors with Analyzer.
Is that okay?

Thank you,

@A_Learner,

Absolutely ok. These are good to have standardization suggested by UiPath. You can update the code if you like or ignore it.

Thanks,
Ashok :slight_smile:

1 Like

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