cancel
Showing results for 
Search instead for 
Did you mean: 

Using Date.now() while exporting files

darshthakkar
Valued Contributor

Hi Team,

While writing files via sftp, I’m unable to ingest Date.now() in the filename itself as seen in the snaps below:

(1) Successful execution [passing pipeline parameter and selecting the ‘=’ decorator
image

(2) Failed execution [NEITHER passing any parameter NOR selecting ‘=’ decorator]
image

The reason behind not selecting = decorator is - “I’m not passing any parameter to dynamically generate filename”
If the file name needs to be constant and it needs to be exported via sftp with Date.now(), what tweaks should I do? I’m pretty sure, snapLogic would be able to handle that and I might be doing something wrong here.

Thanks in advance for your help 🙂

Regards,
DT

1 ACCEPTED SOLUTION

Understood but I don’t think it’s the problem with the static or dynamic reference if you can write other files to the FTP server without any problems. The only thing I could think of is that the filename contains illegal characters.

Can you please try the expression below first?

Date.now().toLocaleDateTimeString({"format":"yyyyMMddHHmmss"})

View solution in original post

21 REPLIES 21

What does the timestamp part look like after the ID prefix? Does it has colons?

@siwadon: I tried putting Date.now() in the file path which was having _pipelineParameter as its file name but it is showing the same error now.
It was working at the beginning of this week but I didn’t want Date.now() for the dynamic file name so I deleted all the generated files (~5k) and cleared the recycle bin as well.

If I’m able to replicate the same, I will keep you posted and apologies as I couldn’t share the required details and file as well for your validation purposes.