none
Input file name to target field RRS feed

  • Question

  • Hi

    My incoming file is a single Flat file which contains bulk records.

    can any one tell me how to assign incoming file name to a filed in target schema, i was already tried using 

    MyDestinationMessage.FileNameField=MyInputMessage(FILE.ReceivedFileName);

    for this we need to promote a perticular field in target schema , But we can't do it here because it is unbounded, And when i try assigning value using xpath , it works fine for a single record , when we process more records in a single file , i am getting xpath selection exception.

    Please let me know any solution for this..

    Thanks In Advance


    panadi

    Monday, April 18, 2016 12:09 PM

Answers

  • we are Counting the numer of records received and process them one by one in loop till loop counter reach to no of rec,

    can anyone tell me without promoting the field in target schema and without using xpath can we do this or not?

    Thanks


    panadi


    As you already know, you cannot promote the field in the target schema as it's unbound. There are more ways to do this (like loading the traget in a XmlDocument and populating it there), but XPath is probably one of the better ways to do it. There is no reason to use any other round about approach.

    Thanks Arindam

    • Marked as answer by panadi Tuesday, April 19, 2016 2:55 PM
    Monday, April 18, 2016 1:36 PM
    Moderator

All replies

  • Hi Panadi,

    I have below questions to you.

    • a single file with multiple records, you need to map received file name / file name (part of file content) from each record to a target field files.
    • Something wrong in your XPath query against your message.
    • Can you post your XPath with the sample file details used?

    Thanks, SMSVikasK

    Monday, April 18, 2016 12:35 PM
    Answerer
  • Hi Vikas,

    Thanks For the reply

    i need to map received filename,

    varFileName = RcvFileMsg(FILE.ReceivedFileName);

    xpath(sendMsg,"/*[local-name()='insertstoredprocedure' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo']/*[local-name()='FileName' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo']") = varFileName;

    if we use loop it works fine , but taking more time, please let me know the otherway to improve performance .

    Thanks


    panadi

    Monday, April 18, 2016 12:56 PM
  • Have you measured the performance? Xpath is the correct approach for your scenario.

    Thanks Arindam

    Monday, April 18, 2016 12:57 PM
    Moderator
  • we are using loop mechanism, it is looping for each and every record, is it possible to process them as whole or not.

    if we process them as whole without loop i am getting xpath selection exception.


    panadi

    Monday, April 18, 2016 1:03 PM
  • What are you looping on? Is it based on the occurrence of some source element?

    Thanks Arindam

    Monday, April 18, 2016 1:11 PM
    Moderator
  • we are Counting the numer of records received and process them one by one in loop till loop counter reach to no of rec,

    can anyone tell me without promoting the field in target schema and without using xpath can we do this or not?

    Thanks


    panadi


    • Edited by panadi Monday, April 18, 2016 1:24 PM
    Monday, April 18, 2016 1:16 PM
  • Hi Panadi,

    Instead of doing a loop in orch to map the field to each record in dest you can,

    Create a message Say:

    <Root>

    <InputFileName>MyFile</InputFileName>

    </Root>

    Then use a multiple input map where u select ur FF schema and ur new message as Input and FF as ur output,

    Then u do in a map the filenamefield mapping.


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

    Monday, April 18, 2016 1:33 PM
    Answerer
  • we are Counting the numer of records received and process them one by one in loop till loop counter reach to no of rec,

    can anyone tell me without promoting the field in target schema and without using xpath can we do this or not?

    Thanks


    panadi


    As you already know, you cannot promote the field in the target schema as it's unbound. There are more ways to do this (like loading the traget in a XmlDocument and populating it there), but XPath is probably one of the better ways to do it. There is no reason to use any other round about approach.

    Thanks Arindam

    • Marked as answer by panadi Tuesday, April 19, 2016 2:55 PM
    Monday, April 18, 2016 1:36 PM
    Moderator
  • Hello Panadi,

    Processing whole at one time without debatching is not possible because you need to get the variable  file name from each record.

    you could debatch at the receive pipeline level and process the messages.Assuming that you just want to debatch the messages and assign the file name and send it to file location. This process will be lot faster.

    depending on your requirement either you can debatch at the receive pipeline OR use loop get record by record for additional processing.

    Thanks,

    Bobby.

    Monday, April 18, 2016 1:37 PM