none
receive filename

    Question

  • i have a flatfile and i have to get the name of that flat file in the orchestration and should insert into the sqlserver with a new column into a table  and i should send that file name to Biztalk and from there to client based on that file name  in an order how can i achieve this  

     

     

    waiting for reply

     

    Thursday, August 05, 2010 10:17 AM

Answers

  • i am using the Expression

     

    xmldocument=new System.Xml.XmlDocument();

    xmldocument.LoadXml("<VerifikatReq><FileName>" + FileName + "</VerifikatReq></FileName>");

    SqlInsert=xmldocument


    Your Xml is incorrect. Reverse the order of the closing tags:
    "<VerifikatReq><FileName>" + FileName + "</FileName></VerifikatReq>"

     

    Friday, August 06, 2010 9:10 AM
  • Are you using the receivedfilename property to pickup similar messages in the same orchestration like correlating on file names? E.g. with parallel actions of with a singleton orchestration?
    If this is the case, one orchestration will possibly handle both files and depending on the logic in it it could aggregate it. But personally I fon't think this is your case

     ed hardy hoodies Is the output message name the same for both files (received file name property)?billig ed hardy   If this is the case, the file adapter is probably  appending the data in the same file! You can then do the following:
    1. In the properties of the file adapter on the OUT side, set  the COPY MODE to "Create new". This will make a new file for each output.
    2. You should make the file names unique by appending something to it (receivedFilename + timestamp for example).

    Monday, August 09, 2010 7:31 AM

All replies

  • Hi,

    I would suggest you to create a custom pipeline component to promote the file name to the context property of the incoming message and access the same context propery in your Orchestration using an expression shape.

    Regards,

    Abhijit

     


    Please "Mark as Answer" if Post has Answered the Question
    Thursday, August 05, 2010 10:28 AM
  • The FILE adapter already promotes the FILE.ReceivedFilename property and the FTP adapter promotes the FTP.ReceivedFilename property.

    You can access these in your orchestration using this code:
    stringVariable = InputMessage(FILE.ReceivedFilename);

    Thursday, August 05, 2010 10:56 AM
  • how can i use the schema which is generated by sqlserver while  receiving the data from sqlserver in the same orchestration

     

    it was showing use of unconstructed message

     

     

    reply mee  

    Thursday, August 05, 2010 11:55 AM
  • You would be able to fetch the filename from the BTS.ReceivedFileName property as Greg mentioned. You have to construct the sql request message (generated from wizard) in the construct message shape. In the construct message shape you can load xml into the System.Xml.XmlDocument variable like xmldocument.LoadXml("<SqlRequestschema><filename>" + filenamefromcontextproperty + "</SqlRequestschema></filename>"); and then assign the xml document to the sql request message.

     


    Abdul Rafay - MVP & MCTS BizTalk Server
    blog: http://abdulrafaysbiztalk.wordpress.com/
    Please mark this as answer if it helps.
    Thursday, August 05, 2010 12:53 PM
  • to which type the orchestration variable i need to set

    if i set the variable to string  in sqlserver i am not getting the exact filename  but  it was in some format like  

    L;2009000085;2009-10-01;2009;2;10;200909;2009-10-0

    how can i get the exact filename into sqlserver

     

    reply me soon

    Friday, August 06, 2010 4:19 AM
  • it was showing can only modify a message specified in the construct shape
    Friday, August 06, 2010 5:15 AM
  • i am getting this message in Administration console

     

    Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'IFSAvante.BizTalk_Orchestration1(f0182be8-d8f2-2173-bf69-353cfc0b0b97)'.
    The service instance will remain suspended until administratively resumed or terminated.
    If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
    InstanceId: 73ea4f80-fa90-44e6-bfd8-20953885db13
    Shape name: ConstructMessage_1
    ShapeId: 2525b19e-f65a-4c06-a0b9-7f8965ce0700
    Exception thrown from: segment 1, progress 11
    Inner exception: The 'FileName' start tag on line 1 does not match the end tag of 'VerifikatReq'. Line 1, position 54.
           
    Exception type: XmlException
    Source: System.Xml
    Target Site: Void Throw(System.Exception)
    The following is a stack trace that identifies the location where the exception occured

       at System.Xml.XmlTextReaderImpl.Throw(Exception e)
       at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
       at System.Xml.XmlTextReaderImpl.Th

    Friday, August 06, 2010 8:43 AM
  • i am using the Expression

     

    xmldocument=new System.Xml.XmlDocument();

    xmldocument.LoadXml("<VerifikatReq><FileName>" + FileName + "</VerifikatReq></FileName>");

    SqlInsert=xmldocument

    Friday, August 06, 2010 8:43 AM
  • Is xml that you are loading the one you  generated from the adapter? I think that the message you are parsing in the xml document is not correct, since there are no namespaces in it etc.

    You should take the sql xsd --> and right click --> select "Generate Instance". use that xml to assign the filename in it. Then assign it to you SqlInsert message.

     

     

    Sahin

    Friday, August 06, 2010 8:52 AM
  • i am using the Expression

     

    xmldocument=new System.Xml.XmlDocument();

    xmldocument.LoadXml("<VerifikatReq><FileName>" + FileName + "</VerifikatReq></FileName>");

    SqlInsert=xmldocument


    Your Xml is incorrect. Reverse the order of the closing tags:
    "<VerifikatReq><FileName>" + FileName + "</FileName></VerifikatReq>"

     

    Friday, August 06, 2010 9:10 AM
  • thanks for ur reply 

    its working

    but  i am getting only one xml file

    my project requirement is to send data to sql server and receive from there and send to client 

    when i drop two FF's in Csv format with same period like(01/04/2010) in both files i am getting only one xml file with combined records of both files  but i should get two seperate xml files  i have tried it using ReceivedFileName property in orchestration  i am using two orchestrations 

    i want to use only one orchestration how can we do that

    waiting for ur reply 

    Friday, August 06, 2010 11:03 AM
  • Could you explain some more on the logic in the interface.

    You are talking about sql server and csv formats and xml files. Could you describe the process in more detail so i can give you help on this one.

     

    If you want only one instance of you orchestration, you should implement a singleton pattern.

     

    Regards,

    Sahin

    Friday, August 06, 2010 11:13 AM
  • we have two companies IFS and Avante

    we need to send the data from IFS to Avante

    IFS company uses FLAT file Format

    Avante Uses XML format

    we are using Biztalk In Middle

    there is one flatfile with different time periods like (01/01/2009)(01/09/2010)(01/11/2010)

    so when i drop that flat file in INFolder it converts to xml and was send to out folder with
    three xml files(ie when we set the polling interval in Recieve adapter of sql server)(based on polling interval
    we get differnt Xml Files in output with a particular time period for each xml file)

    ((the project Requirement is When we drop two Flatfiles with same time period in both the files like(01/01/2009) in InFolder We should get two Xml files in OutFolder with same time period like(01/01/2009)
    but we are getting only (ONE Xml FIle with combined records of Both the Files)))

    the stored procedures for inserting into sql server and selecting and updating the stored procedure are

    insertVerifikat.xsd and selectVerifikat.xsd 

    Actually i have schemas

    FlatFile20.xsd(source)

    FlatFileHeader.xsd

    insertVerifikat.xsd(while inserting into sqlserver with a stored procedure Generated)

    selectVerifikat.xsd(while selecting and updating the stored procedure Generated)

    AvanteGL1.xsd(destination)

    i have used one map in between FlatFile.xsd and Insertflatfile.xsd(SQLMap40_01.btm)

    second map to convert from  selectFlatfile.xsd  to AvanteGL1.xsd(SQLVerifikatToAvanteGL.btm)

    i want to use orchestration in implementing it  and  i  am trying based on receivedFileName property in orchestration


    or if possible any Scripting in the maps to solve the problem

    Friday, August 06, 2010 11:19 AM
  • I think that both IN files are picked up by the same orchestration and then aggregated to one xml file on the OUT side?

    Are you using the receivedfilename property to pickup similar messages in the same orchestration like correlating on file names? E.g. with parallel actions of with a singleton orchestration?
    If this is the case, one orchestration will possibly handle both files and depending on the logic in it it could aggregate it. But personally I fon't think this is your case

    Is the output message name the same for both files (received file name property)? If this is the case, the file adapter is probably  appending the data in the same file! You can then do the following:
    1. In the properties of the file adapter on the OUT side, set  the COPY MODE to "Create new". This will make a new file for each output.
    2. You should make the file names unique by appending something to it (receivedFilename + timestamp for example).

    Friday, August 06, 2010 11:30 AM
  • Ow and i don't think scripting functoids will solve your problem, because the scripting happens during the mapping and it process one file at the time.
    Friday, August 06, 2010 11:31 AM
  • to which type the orchestration variable i need to set

    if i set the variable to string  in sqlserver i am not getting the exact filename  but  it was in some format like  

    L;2009000085;2009-10-01;2009;2;10;200909;2009-10-0

    how can i get the exact filename into sqlserver

     

    reply me soon

    Monday, August 09, 2010 6:24 AM
  • Are you using the receivedfilename property to pickup similar messages in the same orchestration like correlating on file names? E.g. with parallel actions of with a singleton orchestration?
    If this is the case, one orchestration will possibly handle both files and depending on the logic in it it could aggregate it. But personally I fon't think this is your case

     ed hardy hoodies Is the output message name the same for both files (received file name property)?billig ed hardy   If this is the case, the file adapter is probably  appending the data in the same file! You can then do the following:
    1. In the properties of the file adapter on the OUT side, set  the COPY MODE to "Create new". This will make a new file for each output.
    2. You should make the file names unique by appending something to it (receivedFilename + timestamp for example).

    Monday, August 09, 2010 7:31 AM