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-27-2022 08:07 AM
First, check the spelling, I wrote the expression from the image you provided, so I may have missed something.
Also, I noticed that you’re using 2 different snaps in your samples above, so check if the Account is properly configured.
04-27-2022 08:11 AM
@bojanvelevski, I didn’t copy paste the link you provided as I have a different sftp location [which I can’t share unfortunately publicly]
Regarding account, yes, both the snaps have been mapped to the right account —> I double checked it.
Really appreciate your attention to detail, both the points were valid but it has already been taken care of!
04-27-2022 02:21 PM
Check if the directories are already created and the path is valid. There’s an option within the File Writer snap that allows you to create the directories/path provided, if they’re not already present.
Try this and let me know.
04-28-2022 03:35 AM
This is not a concern as I’m able to write files at the same location without Date.now()
04-29-2022 12:45 PM
@siwadon: Thanks for the clarification, I’ve replied to my previous comment so that you can check the screenshot of a successful run.
Date.now() works well if I’m passing a parameter for writing my files however if I provide a static name to a file (e.g. TestFile) and want to ingest Date.now(), it doesn’t work.
Again, Date.now() to a static file name would work if the files are written in snapLogic Manager however I faced the challenge while writing the files to a sftp.
Let me know if you need any further clarifications and I would be more than happy to provide you all the details.