cancel
Showing results for 
Search instead for 
Did you mean: 

Code Stage Output Parameter not working

MohiniShelke
Level 4
Hello All,

I am using code stage using and  I have written some code for filter.
This will return data into DataTable variable.

But when I am defining it in Output parameter it throwing some error.
Below is the part of code :

string strSummaryFileName = "C:\\BankOfSingapore\\HongKong\\Input\\Headcount Summary\\v2 Headcount Summary (LnD)_with Staff Movement.XLSX";
strSummaryFileName = "C:\\BankOfSingapore\\HongKong\\Input\\Headcount Summary\\v2 Headcount Summary (LnD)_with Staff Movement.XLSX";/ 
string strFunctionalTitleFileNm = "C:\\BankOfSingapore\\HongKong\\Input\\Functional title\\Functional Title.xlsx";        
string strTitleSheetName = "M2 Only";       
string strFileExtension = ".xlsx";           
DataTable dtHeadCountSummary = ReadHeadCountSheet(strSummaryFileName, strFileExtension);           
DataTable dtFormatedSummary = ChangeTheHeaderNm(dtHeadCountSummary);           
DataTable dtFunctionalTitle = ReadFunctionalTitle(strFunctionalTitleFileNm, strTitleSheetName, strFileExtension);           
DataTable dtReportData = FilterHeadCountSheet(dtFormatedSummary, dtFunctionalTitle); }

dtReportData -->This is the DataTable that i want as collection out from Code stage into BluePrism.

This is the is Output Varaiable:
29066.png


This is the ereor message:

Description:
1.Compiler error at line 8: A local variable named 'dtReportData' cannot be declared in this scope because it would give a different meaning to 'dtReportData', which is already used in a 'parent or current' scope to denote something else

2.Description: Compiler warning at line 35: The variable 'ex' is declared but never used
Repairable: No

Can anyone knows what is the issue here?

Thanks in advance






------------------------------
Mohini Shelke
RPA Developer
vElement It
------------------------------
1 REPLY 1

John__Carter
Staff
Staff
dtReportData is declared twice, once in your code and once as the output. Effectively what BP does is to create a method like this:

Sub Code1(Byval MyInput As String, ByRef MyOutput As Boolean)
 *your code here*
End Sub

So you can't declare a variable with the same name as one of the inputs or ouputs. So all you need to do is remove the word DataTable from the start of your last line.

------------------------------
John Carter
Professional Services
Blue Prism
------------------------------