Welcome Guest! Log in
×

Notice

The forum is in read only mode.
Stambia versions 2.x, 3.x, S17, S18, S19 and S20 are reaching End of Support January, 15th, 2024. Please consider upgrading to the supported Semarchy xDI versions. See Global Policy Support and the Semarchy Documentation.

The Stambia User Community is moving to Semarchy! All the applicable resources have already been moved or are currently being moved to their new location. Read more…

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
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
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
Thanks It work.
More
29 Jun 2016 08:03 #4 by Prashant.Sangle
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
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
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
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
Thanks. It works.