EXPORT to a file name that is stored in an attribute

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
ask180
Posts: 160
Joined: Thu Oct 04, 2012 11:40 pm

EXPORT to a file name that is stored in an attribute

Post by ask180 »

Guys,

I am attempting to define an EXPORT action in a process, with the objective of exporting data to a .csv file that is located in a different folder each day. From what I can see, the EXPORT action requires a hard-coded file name (eg: c:/folder/file.csv). I need to generate a different path for the file each day, to keep a history, so I was thinking of generating and storing the path and file name in an attribute:

BatchForChecking.FileName (plain text 120) = 'c:/Folder/' + CURRENT_DATE

or something like that.

So the EXPORT action I coded looks like: EXPORT 'SourceDocument_export' TO BatchForChecking.FileName FOR UPDATE

I also tried: EXPORT 'SourceDocument_export' TO 'BatchForChecking.FileName' FOR UPDATE

When I run it, I get an Internal Error message, and the process falls over.

When I configure it as: EXPORT 'SourceDocument_export' TO 'c:/myfolder/Results.csv' FOR UPDATE
it works fine.

So my question is: Is it possible to define the TO path in the EXPORT action in a business object variable?
aware_support
Posts: 7523
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: EXPORT to a file name that is stored in an attribute

Post by aware_support »

For all subtleties of the Rule Language check the Rule Language Guide. It says that an Aritmetic Expression can be used after the "TO" keyword. So Aware IM should support the path stored in an attribute. If it doesn't work for you check the error you are getting. Maybe the path you are providing is invalid. Or maybe there is a bug.
Aware IM Support Team
ask180
Posts: 160
Joined: Thu Oct 04, 2012 11:40 pm

Re: EXPORT to a file name that is stored in an attribute

Post by ask180 »

Thanks Support,

I checked the rule language guide. It turns out that the path I was supplying was invalid. My issue.

It now works brilliantly.
UnionSystems
Posts: 197
Joined: Fri Jun 17, 2016 7:10 am
Location: Brisbane Australia
Contact:

Re: EXPORT to a file name that is stored in an attribute

Post by UnionSystems »

When dealing with server directories the FILE_EXISTS() function and MAKE DIRECTORY action can be useful. You can check a directory exists with FILE_EXISTS() and if it does not exist you can create it with MAKE DIRECTORY.

Code: Select all

IF FILE_EXISTS(SystemSettings.BatchFileLocation)='No' THEN 
DISPLAY MESSAGE 'Creating directory '+SystemSettings.BatchFileLocation
MAKE DIRECTORY SystemSettings.BatchFileLocation
Not certain but I think if a directory is nested inside other directories you may need to create each directory in turn.
AWS Linux, Windows Server, AIM 8.4 & 8.6
Post Reply