Skip to Content
author's profile photo Former Member
Former Member

Read file name from Payload (File Adapter)

Hello experts,

with Receiver-File Adapter I want to save a specific file. Name is given in the xml payload. I use Variable Substitution.

My structure is like this:

<root>
    <elements>
        <name>name1</name>
    </elements>
    <elements>
        <name>name2></name>
    </elements>
</root>

File name schema: %file%

Variable Substitution:

File Name: file

Reference: payload:root,1,elements,1,name,1

With this expression my file adapter creates two files (as recommended), but they have both the name "name1". I want to create n files with n different names, given by one xml structure. How can this task be done? Setting the occurency from "1" to "n" or "*" does not work.

Thank you very much!

Ilona Seifert

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Jan 09, 2007 at 01:09 PM

    hi,

    if you have XI SP14 don't use variable Substitution

    use the method described in my weblog

    (easier to use and allows better handling

    you can concat two values for the filename etc):

    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

    Regards,

    michal

    -


    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 10, 2007 at 04:59 AM

    Hi,

    Not sure I get the entire flow here. You are creating N files ( and so ) you will have N different Messages coming into your Receiver File adapter . So, if you want to use Dynamic File Name then make sure that the filename is in the same element in the same occurence in every file.

    Can you maybe explain the requirements a bit further?

    Regards

    Bhavesh

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Bhavesh,

      This is a test scenario, to discover the abilities of File Adapter.

      I have one csv-file, having n lines. Each line is representing an independant record. Sender File Adapter transforms the csv file to the xml data structure I mentioned in the first posting. So I have n record sets in the xml, every new recordset is introduced with the name-tag. With Receiver File Adapter I want to split this xml file into n separate files, each one carrying the name <name>. I hope made my issue clear.

      Kind Regards

      Ilona

  • Posted on Jan 10, 2007 at 08:29 AM

    Hi,

    Like pointed by you , your source strucutre,

    <root>
        <elements>
            <name>name1</name>
        </elements>
        <elements>
            <name>name2></name>
        </elements>
    </root>

    The target strucuture after mutlimapping will be like,

    My structure is like this:

    <root>
        <elements>
            <name>nameX</name>
        </elements>
       </root>

    Now, using Variable Name substitution, you will have the "name " element at a fixed level always , <b> payload:root,1,elements,1,name,1</b> and so you Variable Name subsitution will also work fine.

    Hope it clears,

    Regards

    Bhavesh

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.