Hi,
My query may be too simple but I am stuck and my mind is no more working.
I am assigning ReportFilePath=path.Combine(Environment.CurrentDirectory, in_MonthlyReportsDownloadPath, “Report-”+in_TaxID+“-”+in_Year+“-”+month.ToString+“.csv”)
and so it is generating file as “C:\Users\HP1\Documents\UiPath\UiPath_REFrameWork_GenerateYearlyReport\ReFrameWork_GenerateYearlyReport_Performer\Data\Temp\Report-RO254678-2017-January.csv”
which technically is correct as Months is an array of string type, where month is an individual array item.
But the problem is I want the report to be saved as “Report-RO254678-2017-1.csv” and not Report-RO254678-2017-January.csv"
How to get “1” from the string array with “January”? Pls help.
monthInDigit = DateTime.ParseExact(month, “MMM”, CultureInfo.InvariantCulture).Month;
This will return you integer
Then you can save mothInDigit as string
Not exactly, you pass the value of the Month sy, January in the month part and it will give you 1.
So if you use that whole below in the file naming part
Here
ReportFilePath=path.Combine(Environment.CurrentDirectory, in_MonthlyReportsDownloadPath, “Report-”+in_TaxID+“-”+in_Year+“-”+month.ToString+“.csv”)
You will get your required result.
So yo will use:
ReportFilePath=path.Combine(Environment.CurrentDirectory, in_MonthlyReportsDownloadPath, “Report-”+in_TaxID+“-”+in_Year+“-”+DateTime.ParseExact(month, “MMM”, CultureInfo.InvariantCulture).Month+“.csv”)
Hi @Aishwarya28
In the type into activity, try unchecking the simulate type and instead of clicking on the save button try using the enter short key.
So the value will look like this: ReportFilePath+ “[k(enter)]”
instead of month , you can pass array index. set a counter variable to 1.
for each month in Months
select month from dropdown
click download
verify if report exists
on save (Environment.CurrentDirectory, in_MonthlyReportsDownloadPath, “Report-”+in_TaxID+“-”+in_Year+“-”+counter.ToString+“.csv”)
increment count -make sure increment operation is outside if
counter=counter+1
let me know if this helps
I am getting error in "System1_CreateYearlyReport.xaml’ while assigning the value to Variable “ReportFilePath”
The value I have tried so far are as below -
-
path.Combine(Environment.CurrentDirectory, in_ReportDownloadPath,“Report-” +in_TaxID+ “-” +in_Year+ “-” +month.ToString+ “.csv”)
-
path.Combine(Environment.CurrentDirectory, in_ReportDownloadPath,“Report-” +in_TaxID.ToString+ “-” +in_Year.ToString+ “-” +month.ToString+ “.csv”)
-
path.Combine(Environment.CurrentDirectory, in_ReportDownloadPath,“Report-” +in_TaxID.ToString()+ “-” +in_Year.ToString()+ “-” +month.ToString()+ “.csv”)
-
path.Combine(Environment.CurrentDirectory, in_ReportDownloadPath,“Report-” +in_TaxID+ “-” +in_Year+ “-” +month+ “.csv”)
Fourth option gives ‘validation’ error and is getting fixed if I add +month.ToString+
Otherwise the error message is similar every time. Following is the error -
Activity Name Assign
Message Value cannot be null
parameter name: path2
Global Exception Handler N/A
“in_ReportDownloadPath” Argument is created as “String”.
Please help!