04-26-2022 02:43 PM
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
(2) Failed execution [NEITHER passing any parameter NOR selecting ‘=’ decorator]
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
Solved! Go to Solution.
04-29-2022 01:26 PM
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"})
04-29-2022 01:26 PM
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"})
04-29-2022 02:51 PM
This worked, THANKS A TON for your help @siwadon.
04-29-2022 02:56 PM
@siwadon: Why would Date.now() work without any errors while passing a parameter and generating file names dynamically vs not working for a static file name? (both of them were written via a sftp itself)
04-29-2022 03:32 PM
Why would Date.now() work without any errors while passing a parameter and generating file names dynamically
I doubt that it would work without removing the colons because that’s the only difference. Can you verify if the file is written successfully? If that works, what is the filename you see on the server side?
04-29-2022 03:42 PM
Yes, the file was written successfully, in fact I generated ~5k html files on the sftp.
Moreover, the file name was unique, the file had 20+ columns but there was a column named ID (unique values) which was used as file name. The file name was sent as a parameter as you can see from the snap. i.e. _pipelineParameter