There is a formula in config file =Text(Today(),“MM\dd\yyyy”) which should always give me today’s date in text format when the bot runs.
Note: Excel config file is stored on a shared location and not in the .nuget package.
It is working perfectly fine in Dev and Testing machines, but as soon as we made the bot live in production this issue started.
1st day of production run was smooth: before running the bot i opened the config file made few production related changes, saved the file and closed it. I ran the bot and bot picked the correct Today’s date.
2nd day of production run: I ran the bot directly without opening the excel file and was shocked to see that bot picked the wrong date as of yesterday (1st day of production run). I opened the excel file and in the excel file the formula is correct and displaying the correct value. I saved the excel file and closed and re ran the bot, this time bot ran and picked the correct value.
3rd day of production run: Same issue happened, again opened the config file date value is correct, saved the config file and closed it. Re ran the bot and it ran successfully.
Now every time I want to run the bot i have to open the config file - save it and close it for the bot pick the correct date value from the forumla.
I have checked multiple times that the bot is pointing to the correct config file and all the configuration is correct.
We have the same logic to pick the date from config file in other bots/process also and it is working fine there. It is just we are facing this issue only on this particular machine.
May I know why not use now.tostring("MM/dd/yyy") directly in the code instead of getting todays date from config?
That looks wierd but if you still want the excel one to work before reading try opening the excel using excel application scope and save and close that should make the formula work…
Check the settings in excel on the machine …go to excel options and check the calculation and recalculation options if they are automatic
There can be some instances where i will need to pass the old date instead of Today’s date from the config (Business requirement).
I am looking for a solution which does not require the code change, for code change we will have to go through the whole RPA life cycle to deploy the change in production.
I will try the Calculation and Re Calculation setting. Can you please help me where can i find these settings.
For that you can use an asset…and when you need a different date pass a value in asset else pass asset as NA and when it is NA use the current date else use the input date from asset…
This way you need not change anything in the code as well. You only need a if condition to check if asset is NA or not
For options go to excel → options → formula → you will find a calculation formula tab …can change the values to automatic there or as required
Calculation wont happen (manual or automatic) until you open the excel file. So if you are already using the workbook activity in project change it to excel scope or if you using excel scope check the calculation settings in Excel app for the users. It should be automatic.
More info at here
1 thing that is bothering me is why the same logic is running on other machines and just having issue only on this machine and what is different in this machine that is causing the issue.
I am trying to find the root cause for this, but for the time being I have no other choice other than to apply the alternate fix in the code.