I have a use case where I need to save info from a website into a Word document daily.
Since the Bot is supposed to run more than once during the day, it should be able to save the word document with the naming: projectName-date-1, projectName-date-2 …
I thought the system would understand if a file with the same name exists and would automatically save the next file with an incremented nr, but there is no such activity apparently?
Create a separate file, let’s call it “counter.txt” to store the current index number. This file will contain a single number that represents the current index.
At the beginning of your bot’s script, read the index number from “counter.txt”. If the file doesn’t exist initially, assume the index number to be 1. After reading the current index number, increment it by one to get the new index.
When saving the Word document, use the projectName-date-index format for the filename. Replace “index” with the value of the new index obtained in step 2.
After saving the Word document, update the “counter.txt” file with the new index so that the next time the bot runs, it knows which index to use.
Use the assets to increment the index number.
=> Create a asset in the Orchestrator with the datatype of integer.
=> Use the Get asset activity to get the index from the orchestrator then use the index number to save the file.
=> After that increment the index number by 1.
=> Use the set asset activity to set the value to the same asset.
Then in the second run it will take the second index number.