Task scheduler issue in Anaplan Connect.

Jsdeloria21
Regular Contributor

Task scheduler issue in Anaplan Connect.

Hi Community,

 

I would like to ask something about the Anaplan Connect. So in our  client model, we created a Anaplan connect to update the current date on the model. This is used for period locking. The date will be used to lock certain period so admin can control the date range of when the users can only enter values to the model. We created a Anaplan connect to regularly update the current date on the model.

 

Issue: the client set the task scheduler to run the Anaplan Connect every day. But when it is run thru the task scheduler it deletes the file destinationcsvfile.csv hence it produces an error on the .bat file. See below.

Before it is run by the task scheduler. The black screen is when the user run it manually. The destination csvfile.csv holds the current date for the model.

 

Jsdeloria21_0-1642404422062.png

 

After the task scheduler run

 

Jsdeloria21_1-1642404445855.png

 

below is the script

 

Jsdeloria21_2-1642404483207.png

 

Appreciate any suggestion you can provide

 

THanks and Regards,

 

 

 

3 ACCEPTED SOLUTIONS

Accepted Solutions
M.Kierepka
Certified Master Anaplanner

Hi,
I believe it is correct that it removes older file. I think the problem is that it fails to create new one, and I think I might know why:
On line 5 of your script you try to create the CSV date file using Excel. But the paths given there are relative (only name of the files), so it works only if you are in the same directory (like running script manually), but not if you run it from Scheduler. You have to change the paths there to absolute paths (like you done for the path on line 16).

View solution in original post

M.Kierepka
Certified Master Anaplanner

What I mean is"
line 5 looks like it tries to do exactly what I described – and it does the job correctly if you run it manually. It only doesn't work when you run it automatically (note that Task Scheduler starts scripts in "some" path, but it's not the path of your script), and I believe it's because in line 5 you use relative paths (just names of files) instead of full paths ("C:\Users\User\Desktop....."). Just add path of the folder with your script before names of the files in line 5, and it should work.

View solution in original post

M.Kierepka
Certified Master Anaplanner

Another solution would be to just change the current path of execution for this script, so it's always in the correct one. You can do it by putting "cd" command with path to your folder on line 3.

View solution in original post

4 REPLIES 4
M.Kierepka
Certified Master Anaplanner

Hi,
I believe it is correct that it removes older file. I think the problem is that it fails to create new one, and I think I might know why:
On line 5 of your script you try to create the CSV date file using Excel. But the paths given there are relative (only name of the files), so it works only if you are in the same directory (like running script manually), but not if you run it from Scheduler. You have to change the paths there to absolute paths (like you done for the path on line 16).
Jsdeloria21
Regular Contributor

Hi M.Kierepka,

 

First of all, I appreciate the time to respond to my query. So your saying is that we need to create a line in row 5 where we will create the destinationcsvfile.csv file? row 5 currently shows below.

 

Jsdeloria21_0-1642405879316.png

we will replace that with a statement where we will create the destinationcsvfile.csv and then test it again.?? it actually make sense.

 

Again appreciate your feedback on the matter.

 

Thanks and Regards,

 

 

M.Kierepka
Certified Master Anaplanner

What I mean is"
line 5 looks like it tries to do exactly what I described – and it does the job correctly if you run it manually. It only doesn't work when you run it automatically (note that Task Scheduler starts scripts in "some" path, but it's not the path of your script), and I believe it's because in line 5 you use relative paths (just names of files) instead of full paths ("C:\Users\User\Desktop....."). Just add path of the folder with your script before names of the files in line 5, and it should work.
M.Kierepka
Certified Master Anaplanner

Another solution would be to just change the current path of execution for this script, so it's always in the correct one. You can do it by putting "cd" command with path to your folder on line 3.