Skip navigation
Currently Being Moderated

How do I name output files based on files processed from a watched folder?

Feb 13, 2012 10:51 AM

Tags: #livecycle #output #workbench #xpath

Hello!

 

I've built a small process to merge XML files with XDP templates, generating PDF files at the end of the process.

 

Right now the process is generating all files with a fixed name + a random number, as defined in the Input panel (literal value with option "Appen a suffix..." checked.

 

I'd like to change this so the resulting files have the same name as the input files, changing only the extension (PDF instead of XML).

 

I believe I should change from literal value to XPath expression, in order to build the resulting name based on the input file name.

 

QUESTION: what function should I use to get the input file name in XPath builder (if this is the right place to do it) ?

 

I tried with:

 

     getDocAttribute(/process_data/@docApolicesXML,"wsfilename")  + ".PDF"

 

Does not work.

 

Thanks a lot for any hints!

 

Marcos

 
Replies
  • Currently Being Moderated
    Feb 14, 2012 12:52 AM   in reply to Marcos J Pinto

    Hi Marcos,

     

    You should do the following:

     

    Create new variable "filename"

     

    And in a Set value you should:

     

    filename = getDocAttribute(/process_data/@docApolicesXML,"basename")

    filename = concat(/process_data/@filename,".pdf")

     

    This will give you "myFile.xml.pdf - if you want myFile.pdf instead, you need to do this in the Set value:

     

    filename = getDocAttribute(/process_data/@docApolicesXML,"basename")

    filename = substring-before(/process_data/@filename,".xml")

    filename = concat(/process_data/@filename,".pdf")


    That should do it :-)

     

    Kim Christensen

    Dafolo A/S

    Denmark


     
    |
    Mark as:
  • Currently Being Moderated
    Feb 14, 2012 6:01 AM   in reply to Marcos J Pinto

    Hi again Marcos,

     

    OK - try to do your concat of the path within a "Set value" step instead, so you have to create another variable "absoluteFilePath" and do your concat.

     

    absoluteFilePath = concat("C:\Users\marcosp\Documents\NetBeansProjects\ConversorDAT_XML\ dist\monitorada\PDF\", /process_data/@fileName)

     

    Then you set your absoluteFilePath variable as the varible your need for the WriteToDisc service.

     

    Also try to enable recording to see what value your fileName actually has.

     

    Hope this helps

     

    Cheers

    Kim Christensen

    Dafolo A/S

    Denmark

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points