Update notepad according to date

How can we achieve the following task

  1. Add next month date in text file
    Example: 7 (Which is For July)
  2. If the month changes then it should replace the earlier value in text file
    —> So next month it should just save 8 in text file replacing earlier value 7

Thanks in Advance:)

image

I’m curious why you’re storing it in a text file. Probably not necessary.

Thanks @postwick for the Solution
I just have a question will the earlier value be replaced every time it runs.

It overwrites the file if the file already exists.

Hello @postwick
Actually the text file is required for a further process where this file would be used to extract specific Information as the month is being used.

Then an Asset would be a better place to put it. Or why can’t the other automation just calculate the number of the next month?

@postwick any way I can get the next month instead of current month

Whoops, sorry…here you go…

DateAdd(DateInterval.Month,1,Now).Month.ToString

Thanks again for your prompt response @postwick

Kind Regards,
@anmita

Hi @anmita,

The txt is read first.
If the txt matches next month, nothing is done.
If it does not match, it is written next month.

Regards,
MY

Why bother with all that? Just overwrite the file each time with the correct number. If it’s the same, it doesn’t matter.

1 Like

You’re right, but I didn’t think it was expected of such a simple thing. I thought that he would put this algorithm in his own setup :slight_smile:

Making sure you saw this reply…

Then an Asset would be a better place to put it instead of a text file. Or why can’t the other automation just calculate the number of the next month?

No actually text file would be fine I suppose

Thanks @muhammedyuzuak for such detailed workflow :smiley:

1 Like

It’s really not a great way to do these things. Assets are more reliable. The most reliable would just be to have the second automation calculate the correct month number itself. Then you don’t need unnecessary extras like text files or assets.

Thanks @postwick for the suggestion. I will try using assets as you mentioned that would be a better way of doing it.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.