Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
26-08-19 10:01 AM
Hi All,
I am using code Stage and i have written code in C# .
I am getting following error:
Page: Initialise
Stage: Stage1
Type: Error
Action: Validate
Description: Compiler error at top section line 7: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
Repairable: No
Here is my Code:
string strSummaryFileName = "E:\\VElement\\filterinputs\\v2 Headcount Summary (LnD)_with Staff Movement.xlsx";//Get the variable from BP
string strFunctionalTitleFileNm = "E:\\VElement\\filterinputs\\Functional Title.xlsx";//Get the variable from BP
string strTitleSheetName = "M2 Only";//Get the variable from BP
string strFileExtension = ".xlsx";
DataTable dtHeadCountSummary = ReadHeadCountSheet(strSummaryFileName, strFileExtension);
DataTable dtFormatedSummary = ChangeTheHeaderNm(dtHeadCountSummary);
DataTable dtFunctionalTitle = ReadFunctionalTitle(strFunctionalTitleFileNm, strTitleSheetName, strFileExtension);
DataTable dtReportData = FilterHeadCountSheet(dtFormatedSummary, dtFunctionalTitle);
I have added certain dependencies.
PFA
Plase help me to solve this error.
Thanks,
------------------------------
Mohini Shelke
RPA Developer
vElement It
------------------------------
I am using code Stage and i have written code in C# .
I am getting following error:
Page: Initialise
Stage: Stage1
Type: Error
Action: Validate
Description: Compiler error at top section line 7: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
Repairable: No
Here is my Code:
string strSummaryFileName = "E:\\VElement\\filterinputs\\v2 Headcount Summary (LnD)_with Staff Movement.xlsx";//Get the variable from BP
string strFunctionalTitleFileNm = "E:\\VElement\\filterinputs\\Functional Title.xlsx";//Get the variable from BP
string strTitleSheetName = "M2 Only";//Get the variable from BP
string strFileExtension = ".xlsx";
DataTable dtHeadCountSummary = ReadHeadCountSheet(strSummaryFileName, strFileExtension);
DataTable dtFormatedSummary = ChangeTheHeaderNm(dtHeadCountSummary);
DataTable dtFunctionalTitle = ReadFunctionalTitle(strFunctionalTitleFileNm, strTitleSheetName, strFileExtension);
DataTable dtReportData = FilterHeadCountSheet(dtFormatedSummary, dtFunctionalTitle);
I have added certain dependencies.
PFA
Plase help me to solve this error.
Thanks,
------------------------------
Mohini Shelke
RPA Developer
vElement It
------------------------------
Answered! Go to Answer.
1 BEST ANSWER
Helpful Answers
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
26-08-19 12:02 PM
The basic answer is that you need to remove the class and method declaration in your Code Stage, since they aren't needed. Read below for the long answer.
Here's a few things that will help orient you toward understanding how to put code in Blue Prism.
Option A: So, the easiest way to do what you have above is to drop the following code into a code stage, and you're done (of course the string inputs are not dynamic at this point):
Option B (part 1 of 2): If you want to use the class and declare a name for your method so that other code stages in the object can reuse the code, then put the following code in the global code:
Option B (part 2 of 2): And then create a code stage on a page/action within the object. And inside that put this code:
Option C (part 1 of 2): If you don't need to worry about the class declaration then it's a tiny bit easier. Put this code in the Global Code:
Option C (part 2 of 2): Put this into a Code Stage:
------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris, 3Ci at Southern Company
Here's a few things that will help orient you toward understanding how to put code in Blue Prism.
- Code stages can only contain the body of a method, not the class or method declaration. Think of the Code Stage itself as a static method that is part of the class of YourObjectName.
- You can only declare classes and methods inside the Global Code, which you can find in the Initialise page inside the Settings stage.
- You do not need to declare a class in the Global Code in order to declare a method, however it does work to create classes with methods inside.
- If you create a method outside of a class in the Global Code, it is effectively a static method and so no object instantiation is necessary. You can just directly call on it from anywhere (depending on the access modifier, such as public).
- To pass inputs to code, you actually declare the variable datatype in a Code Stage's input/output tabs rather than in the code itself.
- You never need a Main method because a code stage is executed if the process flow reaches it.
Option A: So, the easiest way to do what you have above is to drop the following code into a code stage, and you're done (of course the string inputs are not dynamic at this point):
string strSummaryFileName = "E:\\VElement\\filterinputs\\v2 Headcount Summary (LnD)_with Staff Movement.xlsx";//Get the variable from BP string strFunctionalTitleFileNm = "E:\\VElement\\filterinputs\\Functional Title.xlsx";//Get the variable from BP string strTitleSheetName = "M2 Only";//Get the variable from BP string strFileExtension = ".xlsx"; DataTable dtHeadCountSummary = ReadHeadCountSheet(strSummaryFileName, strFileExtension); DataTable dtFormatedSummary = ChangeTheHeaderNm(dtHeadCountSummary); DataTable dtFunctionalTitle = ReadFunctionalTitle(strFunctionalTitleFileNm, strTitleSheetName, strFileExtension); DataTable dtReportData = FilterHeadCountSheet(dtFormatedSummary, dtFunctionalTitle);
Option B (part 1 of 2): If you want to use the class and declare a name for your method so that other code stages in the object can reuse the code, then put the following code in the global code:
class Program { public void doExcelStuff() { string strSummaryFileName = "E:\\VElement\\filterinputs\\v2 Headcount Summary (LnD)_with Staff Movement.xlsx";//Get the variable from BP string strFunctionalTitleFileNm = "E:\\VElement\\filterinputs\\Functional Title.xlsx";//Get the variable from BP string strTitleSheetName = "M2 Only";//Get the variable from BP string strFileExtension = ".xlsx"; DataTable dtHeadCountSummary = ReadHeadCountSheet(strSummaryFileName, strFileExtension); DataTable dtFormatedSummary = ChangeTheHeaderNm(dtHeadCountSummary); DataTable dtFunctionalTitle = ReadFunctionalTitle(strFunctionalTitleFileNm, strTitleSheetName, strFileExtension); DataTable dtReportData = FilterHeadCountSheet(dtFormatedSummary, dtFunctionalTitle); } }
Option B (part 2 of 2): And then create a code stage on a page/action within the object. And inside that put this code:
Program program = new Program(); program.doExcelStuff();
Option C (part 1 of 2): If you don't need to worry about the class declaration then it's a tiny bit easier. Put this code in the Global Code:
public void doExcelStuff() { string strSummaryFileName = "E:\\VElement\\filterinputs\\v2 Headcount Summary (LnD)_with Staff Movement.xlsx";//Get the variable from BP string strFunctionalTitleFileNm = "E:\\VElement\\filterinputs\\Functional Title.xlsx";//Get the variable from BP string strTitleSheetName = "M2 Only";//Get the variable from BP string strFileExtension = ".xlsx"; DataTable dtHeadCountSummary = ReadHeadCountSheet(strSummaryFileName, strFileExtension); DataTable dtFormatedSummary = ChangeTheHeaderNm(dtHeadCountSummary); DataTable dtFunctionalTitle = ReadFunctionalTitle(strFunctionalTitleFileNm, strTitleSheetName, strFileExtension); DataTable dtReportData = FilterHeadCountSheet(dtFormatedSummary, dtFunctionalTitle); }
Option C (part 2 of 2): Put this into a Code Stage:
doExcelStuff();
------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris, 3Ci at Southern Company
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
26-08-19 12:02 PM
The basic answer is that you need to remove the class and method declaration in your Code Stage, since they aren't needed. Read below for the long answer.
Here's a few things that will help orient you toward understanding how to put code in Blue Prism.
Option A: So, the easiest way to do what you have above is to drop the following code into a code stage, and you're done (of course the string inputs are not dynamic at this point):
Option B (part 1 of 2): If you want to use the class and declare a name for your method so that other code stages in the object can reuse the code, then put the following code in the global code:
Option B (part 2 of 2): And then create a code stage on a page/action within the object. And inside that put this code:
Option C (part 1 of 2): If you don't need to worry about the class declaration then it's a tiny bit easier. Put this code in the Global Code:
Option C (part 2 of 2): Put this into a Code Stage:
------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris, 3Ci at Southern Company
Here's a few things that will help orient you toward understanding how to put code in Blue Prism.
- Code stages can only contain the body of a method, not the class or method declaration. Think of the Code Stage itself as a static method that is part of the class of YourObjectName.
- You can only declare classes and methods inside the Global Code, which you can find in the Initialise page inside the Settings stage.
- You do not need to declare a class in the Global Code in order to declare a method, however it does work to create classes with methods inside.
- If you create a method outside of a class in the Global Code, it is effectively a static method and so no object instantiation is necessary. You can just directly call on it from anywhere (depending on the access modifier, such as public).
- To pass inputs to code, you actually declare the variable datatype in a Code Stage's input/output tabs rather than in the code itself.
- You never need a Main method because a code stage is executed if the process flow reaches it.
Option A: So, the easiest way to do what you have above is to drop the following code into a code stage, and you're done (of course the string inputs are not dynamic at this point):
string strSummaryFileName = "E:\\VElement\\filterinputs\\v2 Headcount Summary (LnD)_with Staff Movement.xlsx";//Get the variable from BP string strFunctionalTitleFileNm = "E:\\VElement\\filterinputs\\Functional Title.xlsx";//Get the variable from BP string strTitleSheetName = "M2 Only";//Get the variable from BP string strFileExtension = ".xlsx"; DataTable dtHeadCountSummary = ReadHeadCountSheet(strSummaryFileName, strFileExtension); DataTable dtFormatedSummary = ChangeTheHeaderNm(dtHeadCountSummary); DataTable dtFunctionalTitle = ReadFunctionalTitle(strFunctionalTitleFileNm, strTitleSheetName, strFileExtension); DataTable dtReportData = FilterHeadCountSheet(dtFormatedSummary, dtFunctionalTitle);
Option B (part 1 of 2): If you want to use the class and declare a name for your method so that other code stages in the object can reuse the code, then put the following code in the global code:
class Program { public void doExcelStuff() { string strSummaryFileName = "E:\\VElement\\filterinputs\\v2 Headcount Summary (LnD)_with Staff Movement.xlsx";//Get the variable from BP string strFunctionalTitleFileNm = "E:\\VElement\\filterinputs\\Functional Title.xlsx";//Get the variable from BP string strTitleSheetName = "M2 Only";//Get the variable from BP string strFileExtension = ".xlsx"; DataTable dtHeadCountSummary = ReadHeadCountSheet(strSummaryFileName, strFileExtension); DataTable dtFormatedSummary = ChangeTheHeaderNm(dtHeadCountSummary); DataTable dtFunctionalTitle = ReadFunctionalTitle(strFunctionalTitleFileNm, strTitleSheetName, strFileExtension); DataTable dtReportData = FilterHeadCountSheet(dtFormatedSummary, dtFunctionalTitle); } }
Option B (part 2 of 2): And then create a code stage on a page/action within the object. And inside that put this code:
Program program = new Program(); program.doExcelStuff();
Option C (part 1 of 2): If you don't need to worry about the class declaration then it's a tiny bit easier. Put this code in the Global Code:
public void doExcelStuff() { string strSummaryFileName = "E:\\VElement\\filterinputs\\v2 Headcount Summary (LnD)_with Staff Movement.xlsx";//Get the variable from BP string strFunctionalTitleFileNm = "E:\\VElement\\filterinputs\\Functional Title.xlsx";//Get the variable from BP string strTitleSheetName = "M2 Only";//Get the variable from BP string strFileExtension = ".xlsx"; DataTable dtHeadCountSummary = ReadHeadCountSheet(strSummaryFileName, strFileExtension); DataTable dtFormatedSummary = ChangeTheHeaderNm(dtHeadCountSummary); DataTable dtFunctionalTitle = ReadFunctionalTitle(strFunctionalTitleFileNm, strTitleSheetName, strFileExtension); DataTable dtReportData = FilterHeadCountSheet(dtFormatedSummary, dtFunctionalTitle); }
Option C (part 2 of 2): Put this into a Code Stage:
doExcelStuff();
------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris, 3Ci at Southern Company
