Could you please help for resolving “Index was outside the bounds of the array” error?
I’d like to store file data to ‘str_CurrentReport’
Logic is if there is no current month file, it should be copy from template form and pasted to destination path. and store the file to ‘str_CurrentReport’ variable
@Pankaj.Patil Thank you for your reply!
here it is, when I add (0) at the end, I faced error. So, I’ve deleted.
Directory.GetFiles(“G:\Shared drives(int) P00433_Treasury_Cash_Report\01_Staging\Treasury_CashReport_Final”,““+Today.ToString(“yyyy-MM”)+”.xlsm”)
Hi ! Thank you for your reply.
Understood that the variable at ‘else’ is empty field. How can I fix it…? Should I have to assign it another arr_variable?
@Dorothy_lee - Please print the arr_files using write Line activity using this code String.join(vbcr,arrfiles)…
If this month file not exist then your arr_files(0) will be empty right? So you can’t assign
What exactly you are trying to assign there??
Also, could you please share the directory.getfiles code too? if possible , if could you provide your full requirement ( i think i have been following from the beginning ) , I will try to build a sample flow for you…
Update: You have to do the directory.getfiles again and then you can assign str_currentreport = arr_files(0)…
@prasath17 Hello, Thank you for helps several times:)
I’ve attached my current project file. Could you please refer to Open this month file sequence?
What I try to do now is if possible I’d like to assign newly created file to same variable which is str_currentreport. P00433_Report_Creation - Copy.zip (118.3 KB)
Helo @Dorothy_lee - I have reviewed the your workflow and understood what you are trying to do…
In the bol_First_Tue Else case, you are copying the template the file to the your Treasury_CashReport_Final folder and then renaming the file to Treasury_CashReport_Final" + now.ToString(“yyyy-MM”)+“.xlsm”). So now your template file Main_Template.xlsm will come 2021-05.xlsm and this is the file you are trying to allocate to str_CurrentReport variable right.
So I have added this code to the “str_CurrentReport”, because after you copied the file you have to sweep the directory again to check for the recent file right…?? or else you won’t get the file name from the folder…