Question

Retreive the value of last saved date

  • 25 April 2013
  • 7 replies
  • 5 views

Hi, 

 

 

I would like to retrieve and store in a new attribut the value of Last Saved Date (workspace proporties). 

 

 

I read some articles about the possibility to write a script in python (http://fmepedia.safe.com/AnswersQuestionDetail?id=906a0000000cgosAAA) however I don't know this langage and so I don't kow I can start writing a script. Moreover, I don't want to start writing a script if it exist another method. 

 

 

Could you help me ? 

 

 

Thank you. 

 

 

Aglae. 

 

 


7 replies

Userlevel 4
Hi Aglae,

 

 

as far as I know, a Python script would be the only solution to get this information. I'm sure that the solution proposed by Takashi is a good start.

 

 

Let us know if you have specific questions underway.

 

 

David
Badge +1
Hi Aglae, 

 

 

You can use a Directory and File Pathnames reader for this. If you choose your workspace folder, it will populate attributes for all files contain within it, including date modified, created, etc.

 

 

Owen
Hi Owen, 

 

 

Thank you. I am trying it but the result is not good. 

 

 

I don't find the place where I can specify my workspace folder ? 

 

 

Can you help me ? 

 

 

Thank you. 

 

 

Aglae. 
Userlevel 2
Badge +17
Hi Aglae,

 

 

I remember that article, my answer was voted to bad (:-( I see reading directly fmw file will not be recommended, but I don't think there is a way to get a value of 'Workspace Properties' except that way. But if the real update time (not a Workcpace Property value) is also available for your purpose, using 'Directory and File Pathnames' would be a solution, as Owen suggested.

 

  Takashi
Badge +1
It should work with the reader, as each time the workspace is run it will pick up the latest save date.

 

 

When you add the reader, in the 'dataset' box, just click on the folder of interest, not any files. Then in the parameters- set 'retrieve file properties' to yes.

 

Thank you very much for all your answers, I managed. 

 

 

I used the method of Owen. Perfect. 

 

 

Have a nice day everyone. 

 

 

Aglae. 
Could be done relatively straight forward by using the Workspace runner in advance of running the workspace in question.

 

 

Original "Kick Off" Workspace:

 

1. Text File Reader for the FMW file you are interested in

 

2. String Searcher on the text_line_data attribute, searching for "LAST_BUILD_DATE". There should be only one result

 

3. Using parsing techniques, strip out the date/time information in this line. call this the "LastSavedDate"!

 

4. Because you have only one line of data at this point (from the string searcher) you can pass this directly into a Workspace Runner, which calls the workspace you are interested in. Set a published parameter in this workspace to retrieve the contents of LastSavedDate.

 

 

The concept of using the workspace runner is so that the details of the FMW file can be gathered from outside of workbench, as the results might be skewed if you have the file already open and are repeatedly saving it with updates.

 

 

Hope all that makes sense!

 

Reply