Welcome Guest! Log in
×

Notice

The forum is in read only mode.
Due to some maintenance operations, stambia.org will be switched to read-only mode during the 13th November. It will be possible to read and download, but impossible to post on the forums or create new accounts. For any question please contact the support team.

Topic-icon Question Can I create zip with either core_session_Id or core_end date variable

More
20 Jun 2016 09:32 #1 by Prashant.Sangle
Prashant.Sangle created the topic: Can I create zip with either core_session_Id or core_end date variable
Hello,

I have below scenario.

1: I have to get files from ftp to local
2: Load those file data to db
3: move those file to archive with session id and session time.

I have achieve first 2 task and partially done with 3 but don't know how can archive it with session Id / session time.

Please guide me to achieve it.

Let me know if any details required.

Thanks and Regards,
Prashant Sangle
More
21 Jun 2016 10:19 #2 by Thomas BLETON
Thomas BLETON replied the topic: Can I create zip with either core_session_Id or core_end date variable
Hi,
I would try to use a ZipFile action, and set the archive file name with ${/CORE_SESSION_ID}$ and ${/CORE_SESSION_TIMESTAMP}$
More
22 Jun 2016 07:42 #3 by Prashant.Sangle
Prashant.Sangle replied the topic: Can I create zip with either core_session_Id or core_end date variable
Thanks It work.
More
29 Jun 2016 08:03 #4 by Prashant.Sangle
Prashant.Sangle replied the topic: Can I create zip with either core_session_Id or core_end date variable
Hi,

Core_session_timestamp variable store timstamp in linux numeric date
can I convert it into YYYYMMDDhhmmss

Thanks and Regards,
Prashant Sangle
More
29 Jun 2016 09:51 #5 by Thomas BLETON
Thomas BLETON replied the topic: Can I create zip with either core_session_Id or core_end date variable
Yes this is possible.

First note that there is also the native ${/CORE_BEGIN_DATE}$ session variable, which provides this format: 2016/06/29 09:42:59.848

If you need a specific format, then apply a Rhino date formatting function.
For this, you can create a Variable which will be re-usable in all your developments.
For example:
- Create a Variable Metadata, named "CURRENT_SESSION_DATETIME"
- The default value will be this Rhino expression:
%e(rhino){ java.text.SimpleDateFormat("yyyyMMdd-HHmmss.SSS").format(new Date(${/CORE_SESSION_TIMESTAMP}$)) }e(rhino)%
See SimpleDateFormat Reference to know how to specify your desired format.
- Then use this variable in your file name, e.g. "MyFile_%{CURRENT_SESSION_DATETIME}%"
Don't forget to drag and drop the variable into your processes and mappings where you need it.
More
29 Jun 2016 14:23 #6 by Prashant.Sangle
Prashant.Sangle replied the topic: Can I create zip with either core_session_Id or core_end date variable
Hi,

I have tried what you suggested. but i am getting below error.

Zip files
Problem creating zip: D:\Devl\glb\1054_glb_otif\integration\archieve_files\${\CURRENT_SESSION_DATETIME(_UqvzVT3jEea1ntRCVoXX-w)}$ (The system cannot find the path specified) (and the archive is probably corrupt but I could not delete it)


To test variable working fine or not.
I have drag variable in process and ran process.
I can see that variable in session variable list with required date time format.

But can not use that variable while setting zip_to_file property of zipfiles action

Let me know if any details required.

Thanks and Regards,
Prashant Sangle
More
29 Jun 2016 15:42 #7 by Thomas BLETON
Thomas BLETON replied the topic: Can I create zip with either core_session_Id or core_end date variable
Make sure that your Variable's action is executed BEFORE the zipfile action. Otherwise the var is not set when zipfile runs.
Simply add a link between the Variable action and the Zipfile action.
Is it better?
More
30 Jun 2016 06:56 #8 by Prashant.Sangle
Prashant.Sangle replied the topic: Can I create zip with either core_session_Id or core_end date variable
Thanks. It works.