Getting value from Stored Procedure and using in Mapper

Home Page Forums BizTalk 2004 – BizTalk 2010 Getting value from Stored Procedure and using in Mapper

Viewing 1 reply thread
  • Author
    Posts
    • #14890

      You could perform this function entirely within the map using database functoids.

      If you wish to request the data from SQL using a Solicit/Response send port, then you can create a map that uses both the original message (CSV) and the response from the SQL store procedure.

      In the orchestration a a Transform shape – set create new map.
      Set the source document type – add both the original messsage and the SQL response
      Set the destination to the updategram message.
      You should now have a map with two source schemas (as children of a <root> node).

      You can also set the ID field in the updategram as a distinguished field and the same for the ID result from the store procedure. Perform the map and set the updategram ID value in the map to EMPTY. In a message assignment shape after the Transform set the updategram Id field using the store proc result field
      updategram.ID = sp_result.ID;

      You could do as above using promoted properties or the xpath function.

    • #14891

      Is the SQL query using a value from the incoming batch.
      Is this value present in each debatched message or is it lost when the envelope is discarded?

      • #14892

        I have a project where I am simply converting a CSV(File) into a SQL Insert Updategram. It is pretty basic, but I am doing some file type conversions in the mapper. I have a need whereby, in the Orchistration, execute a receive port for information from a stored procedure. It simply returns an ID number. I then need to use that ID number in the mapper to fill in one of mapped fields. Can someone give me a brief run-down on how this can occur? I guess I am stuck(in my head), figuring out if I need to store the result of the receive port into an orchistartion variable, and if so, how do I use it in the transform for the map?

        Thanks.

        • #14893

          I guess I need to explain more. I cannot keep calling the stored procedure within the map, as it would return different values each time. I need the value to stay constant accross all instances in the incoming message. The incoming message is a flat CSV, which I am \”debatching\” in the pipeline into singular messages. Maybe that’s where I am going wrong?

          • #14894

            Note that you can create a scripting functoid that has no links in or out, and it acts as a global. For instance, if you set a variable (say \”int i = 0;\”) in a scripting functoid at the top, you could use \”i\” in any other functoid later on. In your case, you MAY want to call your proc from the topmost scripting functoid, save the variable in a global, and access it later where needed.

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.