Mapping Loops

Hello all.
I am currently attempting to develop a scenario that takes a CSV file and maps it to an XML file.
I have defined two XML structures, one is a very simple flat one, used for the CSV import in cooperation with the plan2xml adapter module.  The second is a more complex XML structure that will be the target message.
The source file has 5 fields that are multidimensional.  So for example, there is a  field called WEIGHT in which the value of the field may be:
5.800,7.400,4.200,1.606
The target XML structure has an unbounded element, consisting of several subelements.  Looks similar to this:
-UnboundedElement
    -element1
    -element2
    -element3
    -element4
I would like to loop the unbounded element, so that for each multidimensional field in the source message, I can store that data in the unbounded element.  So, more simply, it should look something like this:
Start Loop:
-First iteration:
copy 5.800 to element1 of unboundedelement
-Second iteration
copy 7.400 to element1 of unboundedelement
etc.
(1) First I need to know how to create that loop.
(2) Second, what is the best way to map this?  It seems to me that there should be a way to combine existing functions to make this possible.  But do you think I would have to create a user defined function to do this?
Thanks in advance. I hope I explained this clearly enough.

Close, but a little bit different.
Source message WEIGHT field looks like this:
5800,7400,4200
And the target structure should look like this:
<unboundedelement>
<element1>5800<element1>
<element2/>
<element3/>
<element4/>
</unboundedelement>
<unboundedelement>
<element1>7400<element1>
<element2/>
<element3/>
<element4/>
</unboundedelement>
<unboundedelement>
<element1>4200<element1>
<element2/>
<element3/>
<element4/>
</unboundedelement>
I have decided to avoid the requirements for the loop by simply changing the data type of the target message to have 4 instances of <b>unboundedelement</b>.  However, I still have to split that value in WEIGHT up into multiple target fields.  I believe I can use the <b>substring</b> function, in cooperation with a conditional statement to verify that something exists in that location.  I'm going to try this out, and I'll let you all know if I am still stuck.

Similar Messages

  • Problem with Message-Mapping: Loop over Elements possible?

    Hi all,
    I want do create a Message-Mapping for an IDoc-to-File Scenario. In the Source Structure there are some Elements which can appear more than once (1..unbounded). I need a mechanism which loops over these elements and search for specified values. From the Element which contains an element with this specified value the mapping should write a value in the target structure.
    Here a simple example (source structure) for better understanding:
    <root>
       <invoice>
          <number> 10 </number>
          <sum> 200.00 </sum>
       </invoice>
       <invoice>
          <number> 20 </number>
          <sum> 150.00 </sum>
       </invoice>
       <invoice>
          <number> 30 </number>
          <sum> 120.00 </sum>
       </invoice>
    </root>
    Now the duty of the Mapping should be to search in the elements <invoice> for the number 30. And then the sum of the invoice with the number 30 should be written in a field of the target structure.
    I tried it out with a constant togehter with an equalsS-function and an ifWithoutElse-function, but it is working only then, if the invoice with the number 30 has the first position in the root context.
    Can anybody help me? Thanks
    With kind regards
    Christopher

    Hi,
    Write a UDF to sum the required values and map to target node.
    See while writing the UDF select the type as queue.
    number -- removecontext-UDF targetnode
    sum----removecontext--/
    number abd sum or the two inputs
    in UDF
    int nsum = 0;
    for(int i;i < number.length;i++){
      if number(i).equals("30") then
         nsum = nsum + valueOf(sum(i));
    result.addValue(nsum); // convert the nsum into string
    Regsrds
    Chilla

  • Message Mapping Loop

    Hi,
    I want to have a loop in message mapping.
    For example:
    Customers
      Name (unbounded)
        ID
        GivenName
      Adress (unbounded)
        ID
        City
    ID is the key which determines which Given Name belongs to which city.
    That should be transformed to
    Customers
      Customer (unbounded)
        ID
        GivenName
        City
    Now every Customer has is own element.
    Does anybody have experience with that?
    Regards,
    Udo

    Hi Udo,
    can you this code with <b>advanced user function</b>:
    (with three input values)
    a, b, c
    a - Customers-ID
    b - Adress-ID
    c - Adress-City
    ===============================================
    for (int t =0; t<a.length; t++)
           for (int  j=0; j<b.length; j++)
                   if (a[t].equals(b[j]))
                           result.addValue(c[j]);
    ==================================================
    Regards,
    michal

  • Flat File Mapping -- Looping Scenario

    Hi All,
    I have a flat file structure like below:
    My input flat file is like below:
    H,Header,,,
    O,Address,,,
    L,1,100,,
    L,2,400,,
    SL,2,225,,
    SL,2,175,,
    SL(ScheduledLineRecord) is a optional segment, LineLoop may or may not contain it. The actual quantity from L(DetailLine) segment gets split in SL record. i.e.. In above example 400 in L got splitted in 225 and 175 in SL.
    On Destination side I have a line loop. I want to pass on quantity(3rd element in L/SL segment) in one perticular field. Logic is# If LineLoop having SL then pass on quantity from  "SL" segment to that field. Else pass
    on quanity from "L" segment.
    So if I have input as shown above, then the required field should repeat for 3 times and should contains values as:
    <LineRecord>
        <xyz>100</xyz>
    </LineRecord>
    <LineRecord>
        <xyz>225</xyz>
    </LineRecord>
    <LineRecord>
        <xyz>175</xyz>
    </LineRecord>
    I want to avoid using custom XSLT. Can we do it without custom XSLT? How?
    Thanks, Girish R. Patil.

    You can achive it using custom XSLT or Inline XSLT in script functoid.
    Below script will achive the required results..
     <xsl:for-each select="LineLoop/LineRecord">
            <xsl:variable name ="LRlineNumber" select ="LineNumber/text()"/>
            <xsl:choose>
              <xsl:when test ="count(../ScheduledLineRecord[LineNumber=$LRlineNumber]) > 0">
                <xsl:for-each select ="../ScheduledLineRecord[LineNumber=$LRlineNumber]">
                  <LineRecord>
                    <xyz>
                      <xsl:value-of select="Quantity/text()" />
                    </xyz>
                  </LineRecord>
                </xsl:for-each>
              </xsl:when>
              <xsl:otherwise>
                <LineRecord>
                  <xyz>
                    <xsl:value-of select="Quantity/text()" />
                  </xyz>
                </LineRecord>
              </xsl:otherwise>
            </xsl:choose>      
          </xsl:for-each>
    You may need to tweek it if there is some namespace or elements or attributes are Qualified in the actual schema.
    Regards &lt;br/&gt; When you see answers and helpful posts,&lt;br/&gt; please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

  • Flash Player And adobe reader not working and downloads don't work

    I have IE 8 and windows vista and everything has worked great for 2 years until 2 or 3 weeks ago.  At that time my flash player stopped working so I could no longer get videos , streaming stock quotes, weather map loops, etc and when I go to websites that use Flash (i.e. Piaaz Hut) it wouldn't work.  Also, at that same time my adobe reader stopped working properly and I can't view mosy PDF Files.
    I have gone through many of the posts on this forum and have tried many of the fixes, but none have work for me.
    I tried to uninstall the Flash Player, but I didn't use the Adobe uninstaller.
    Whenever I try to update or load the Flash player, a dialog box with the globe tossing papers to the folder appears and then after a few seconds I get the the message that IE can't install_flash_player_ax.exe from fp download.adobe.com, and then a message that says IE was not able to open this internet site. The requested site is either unavailable or cannot be found.
    In control panel programs I have listed
    Adobe AIR      no size
    Adobe Flash Player 10 active X           no size
    Adobe Reader 9.3     141mb
    Macromedia Shockwave player      no size
    In Tools i have the following add ons and they are all enabled
    Shockwave Flash object 10.0.42.34
    Adobe PDF Link Helper
    Adobe PDF Reader
    Macromedia Shockwave Active X Control 10.1
    As I said I've already attempted a number of the fixes on this forum, but so far no luck.
    Does anyone have any suggestions on what else I might try?
    Thanks

    Ok, I tried to download the firefox browser but IE wouldn't let me download it.  My friend downloaded it from their computer to a flash drive and I loaded it to my computer from the flash drive.  The download of Firefox from the flash drive worked, and now I'm using Firefox & both my adobe flash player and my adobe reader are working just great.
    However, neither the flash player nor the reader are working if I use IE, so I guess I will just have to use Firefox as my browser.
    I'm going to mark my question as answered since I really don't care that I have to use Firefox instead of IE,although I can't understand why it works using Firefox but not using IE.
    Thank you so much for your assistance in walking me step-by-step through this problem until I was able to reach a satisfactory solution.

  • EXS24 - how to affect speed when creating zones from regions

    So what I want is to be able to change the pitch of a region without changing the tempo of the new region.
    I convert a region to a new sampler track and then map it over say 5 contiguous keys. This allows me to play a loop in 5 different keys no problem, but the higher I go the faster the the loop plays. Is there a way to keep the same tempo and just change the pitch of the mapped loop?
    Thank you,
    paul

    You'll have to make copies of the file and transpose them in "free" mode in the audio time pitch machine and then assign the transposed regions int the sampler. You could also use just the original sample and add a pitch shifting plugin which you could automate to change keys as needed.

  • Mapping/invoking key codes in a GameCanvas's main game loop.

    I'm trying to bind some diagonal sprite movement methods to the keypad. I already know that I have to map out the diagonals to key codes since key states only look out for key presses in the upper half of the phone (d-pad, soft buttons, etc...). Problem is, how do I invoke them in the main game loop since a key state can be encapsulated in a method and piped through the loop? What makes this even worst is a bug that my phone maker's game API (Siemens Game API for MIDP 1.0, which is their own implementation of the MIDP 2.0 Game API) has, in which if I override the keyPressed, keyReleased, or keyRepeated methods, it will always set my key states to zero, thus I can't move the sprite at all. Also, it seems that my phone's emulator automatically maps key states to 2, 4, 6, and 8, so my only concern is how do I map the diagonal methods into 1, 3, 7, and 9, as well as invoking them in the main game loop? Enclosed is the example code that I've been working on as well as the link to a thread in the Siemens (now Benq Mobile) developer's forum about the bug's discovery:
    http://agathonisi.erlm.siemens.de:8080/jive3/thread.jspa?forumID=6&threadID=15784&messageID=57992#57992
    the code:
    import com.siemens.mp.color_game.*;
    import javax.microedition.lcdui.*;
    public class ExampleGameCanvas extends GameCanvas implements Runnable {
    private boolean isPlay; // Game Loop runs when isPlay is true
    private long delay; // To give thread consistency
    private int currentX, currentY; // To hold current position of the 'X'
    private int width; // To hold screen width
    private int height; // To hold screen height
    // Sprites to be used
    private GreenThing playerSprite;
    private Sprite backgroundSprite;
    // Layer Manager
    private LayerManager layerManager;
    // Constructor and initialization
    public ExampleGameCanvas() throws Exception {
    super(true);
    width = getWidth();
    height = getHeight();
    currentX = width / 2;
    currentY = height / 2;
    delay = 20;
    // Load Images to Sprites
    Image playerImage = Image.createImage("/transparent.PNG");
    playerSprite = new GreenThing (playerImage,32,32,width,height);
    playerSprite.startPosition();
    Image backgroundImage = Image.createImage("/background2.PNG");
    backgroundSprite = new Sprite(backgroundImage);
    layerManager = new LayerManager();
    layerManager.append(playerSprite);
    layerManager.append(backgroundSprite);
    // Automatically start thread for game loop
    public void start() {
    isPlay = true;
    Thread t = new Thread(this);
    t.start();
    public void stop() { isPlay = false; }
    // Main Game Loop
    public void run() {
    Graphics g = getGraphics();
    while (isPlay == true) {
    input();
    drawScreen(g);
    try { Thread.sleep(delay); }
    catch (InterruptedException ie) {}
    //diagonalInput(diagonalGameAction);
    // Method to Handle User Inputs
    private void input() {
    int keyStates = getKeyStates();
    //playerSprite.setFrame(0);
    // Left
    if ((keyStates & LEFT_PRESSED) != 0) {
    playerSprite.moveLeft();
    // Right
    if ((keyStates & RIGHT_PRESSED) !=0 ) {
    playerSprite.moveRight();
    // Up
    if ((keyStates & UP_PRESSED) != 0) {
    playerSprite.moveUp();
    // Down
    if ((keyStates & DOWN_PRESSED) !=0) {
    playerSprite.moveDown();
    /*private void diagonalInput(int gameAction){
    //Up-left
    if (gameAction==KEY_NUM1){
    playerSprite.moveUpLeft();
    //Up-Right
    if (gameAction==KEY_NUM3){
    playerSprite.moveUpRight();
    //Down-Left
    if (gameAction==KEY_NUM7){
    playerSprite.moveDownLeft();
    //Down-Right
    if (gameAction==KEY_NUM9){
    playerSprite.moveDownRight();
    /*protected void keyPressed(int keyCode){
    int diagonalGameAction = getGameAction(keyCode);
    switch (diagonalGameAction)
    case GameCanvas.KEY_NUM1:
    if ((diagonalGameAction & KEY_NUM1) !=0)
    playerSprite.moveUpLeft();
    break;
    case GameCanvas.KEY_NUM3:
    if ((diagonalGameAction & KEY_NUM3) !=0)
    playerSprite.moveUpRight();
    break;
    case GameCanvas.KEY_NUM7:
    if ((diagonalGameAction & KEY_NUM7) !=0)
    playerSprite.moveDownLeft();
    break;
    case GameCanvas.KEY_NUM9:
    if ((diagonalGameAction & KEY_NUM9) !=0)
    playerSprite.moveDownRight();
    break;
    repaint();
    // Method to Display Graphics
    private void drawScreen(Graphics g) {
    //g.setColor(0x00C000);
    g.setColor(0xffffff);
    g.fillRect(0, 0, getWidth(), getHeight());
    g.setColor(0x0000ff);
    // updating player sprite position
    //playerSprite.setPosition(currentX,currentY);
    // display all layers
    //layerManager.paint(g,0,0);
    layerManager.setViewWindow(0,0,101,80);
    layerManager.paint(g,0,0);
    flushGraphics();
    }EDIT: Also enclosed is a thread over in J2ME.org in which another user reports of the same flaw.
    http://www.j2me.org/yabbse/index.php?board=12;action=display;threadid=5068

    Okay...you lost me...I thought that's what I was doing?
    If you mean try hitTestPoint ala this:
    wally2.addEventListener(Event.ENTER_FRAME, letsSee);
    function letsSee(event:Event)
              // create a for loop to test each array item hitting wally...
              for (var i:Number=0; i<iceiceArray.length; i++)
                   // if you don't hit platform...
              if (wally2.hitTestPoint(iceiceArray[i].x, iceiceArray[i].y, false)) {
              wally2.y -= 5;}
                          return;
    That's not working either.

  • Get Map values using loops

    Hi,
    With a vector I can have a loop and to get the values with a index.
    Vector vec = new Vector()
    for(int idx=0; idx>vec.size(); idx++){
        System.out.println(vec.get(idx).toString());
    }I can do something similar with a map ? in other words have a loop and get the map values.
    I know that the map a other java.util Collections don't have a
    public Object get(int index)
    method as Vector, but How I can simulate this in a map.
    Some idea ??
    thanks

    what about using an iterator?
    Iterator it = map.values.iterator();
    while (it.hasNext()) {
    Object o = it.next();
    hf,
    dani

  • BizTalk Mapper - Looping multiple nodes to map to a single node in a single row (flat file)

    Hi everybody,
    I'm still new in developing BizTalk app and require some help in this one problem. Appreciate your time and input to help me on this.
    Basically I have an XML document as input and a flat file as output. Example for input is as per below. The "Contact" node's maxOccurs here is set to unbounded and could be multiple. (phone, fax, website, telex ...)
    <root>
    <CustomerName>Company A</CustomerName>
    <Contact>
    <Type>Phone</Type>
    <Locator>03566789</Locator>
    <Type>Phone</Type>
    <Locator>03566790</Locator>
    <Type>Fax</Type>
    <Locator>03566795</Locator>
    <Type>Telex</Type>
    <Locator>03566798</Locator>
    <Type>Website</Type>
    <Locator>www.companyA.com</Locator>
    </Contact>
    </root>
    The expected output in XML would look like below. The final outcome would be a csv file. Strictly Phone 1, phone 2, fax and telex, the rest would be ignored.
    <root>
    <CustomerName>Company A</CustomerName>
    <Phone1>03566789</Phone1>
    <Phone2>03566790</Phone2>
    <Fax>03566795</Fax>
    <Telex>03566798</Telex>
    </root>
    Example of expected output result (csv file): CompanyName;Phone1;Phone2;Fax;Telex;
    In our case here: Company A;03566789;03566790;03566795;03566798;
    Another example could be: Company B;036778911;;036778912;; if only 1 phone number and 1 fax number provided.
    I've used Table Looping and Table Extractor and nearly got the desired result except that it is represented in multiple rows instead of one: Example:
    Company A;03566789;;;
    Company A;;03566790;;;
    Company A;;;03566795;;
    Company A;;;;03566798;
    Any idea how to do the mapping? I'm kind of stuck here and it sounds like an easy problem but i could not find any example to the solution that I need here. Table looping and table extractor is ok to map from single node flat file to multiple nodes but not
    the reverse like in this example.
    rgds,
    sportivo

    Hi,
    Please refer to below links where similar issue has been answered.
    http://social.msdn.microsoft.com/Forums/en-US/biztalkgeneral/thread/ecdff241-6795-4a95-bad7-48fca4410dfb
    http://www.epinaki.com/2011/05/other-options-to-using-biztalk-table-looping-functoid-par-i/
    I hope this helps you.
    Thanks With Regards,
    Shailesh Kawade
    MCTS BizTalk Server
    Please Mark This As Answer If This Helps You.
    http://shaileshbiztalk.blogspot.com/

  • Loop in XSLT Mapping

    Hello experts,
    What is Support inheritence in SAP XI.
    Difference between value,context,Queue.
    How to use LOOP in XSLT mapping.
    Thank you

    Hi,
    Value : Value makes the UDF a simple UDF, wherein u pass only a single value.
    Context : But there might be occasion when you want to pass the input as contexts, then you use context.
    So here you will be looping through each context.
    Introduction to Context Handling in Message Mapping
    Queue : When you want to pass the entire queue, you choose Queue. Here you will looping through the entire queue. Queue contains different contexts.
    Introduction to queues in message mapping
    For XSLT
    http://www.w3schools.com/xsl/xsl_for_each.asp

  • Issue with XSLT For each loop in B2B Mapping

    Hi All,
    I am trying to map the inbound 997 Payload into Headers and Lines Table. I am using the For Each XSLT Construct to map the Loop AK2 of 997 into the 997 Lines Collection.
    Issue I am facing is that if the Loop AK2 is repeated for 33 times then for all the 33 times only its first element's value is getting passed into the target of mapping file.
    in coming payload
    <Loop-AK2>
    <Segment-AK2>
    <Element-143>810</Element-143>
    <Element-329>0001</Element-329>
    </Segment-AK2>
    <Segment-AK5>
    <Element-717>A</Element-717>
    </Segment-AK5>
    </Loop-AK2>
    <Loop-AK2>
    <Segment-AK2>
    <Element-143>810</Element-143>
    <Element-329>0002</Element-329>
    </Segment-AK2>
    <Segment-AK5>
    <Element-717>A</Element-717>
    </Segment-AK5>
    </Loop-AK2>
    <Loop-AK2>
    <Segment-AK2>
    <Element-143>810</Element-143>
    <Element-329>0003</Element-329>
    </Segment-AK2>
    <Segment-AK5>After transformation using XSLT file the payload looks like as follows
    <ns0:XxmfiEdi997_AckLines>
    <ns0:lineId>33</ns0:lineId>
    <ns0:trxSetIdentCode>810</ns0:trxSetIdentCode>
    <ns0:trxSetControlNumber>0001</ns0:trxSetControlNumber>
    <ns0:segmentCode/>
    <ns0:segmentPosition/>
    <ns0:segmentError/>
    <ns0:trxSetAckCode>A</ns0:trxSetAckCode>
    </ns0:XxmfiEdi997_AckLines>
    <ns0:XxmfiEdi997_AckLines>
    <ns0:lineId>34</ns0:lineId>
    <ns0:trxSetIdentCode>810</ns0:trxSetIdentCode>
    <ns0:trxSetControlNumber>0001</ns0:trxSetControlNumber>
    <ns0:segmentCode/>
    <ns0:segmentPosition/>
    <ns0:segmentError/>
    <ns0:trxSetAckCode>A</ns0:trxSetAckCode>
    </ns0:XxmfiEdi997_AckLines>
    <ns0:XxmfiEdi997_AckLines>
    <ns0:lineId>35</ns0:lineId>
    <ns0:trxSetIdentCode>810</ns0:trxSetIdentCode>
    <ns0:trxSetControlNumber>0001</ns0:trxSetControlNumber>
    <ns0:segmentCode/>
    <ns0:segmentPosition/>
    <ns0:segmentError/>
    <ns0:trxSetAckCode>A</ns0:trxSetAckCode>
    </ns0:XxmfiEdi997_AckLines>
    <ns0:XxmfiEdi997_AckLines>
    <ns0:lineId>36</ns0:lineId>
    <ns0:trxSetIdentCode>810</ns0:trxSetIdentCode>
    <ns0:trxSetControlNumber>0001</ns0:trxSetControlNumber>
    <ns0:segmentCode/>
    <ns0:segmentPosition/>
    <ns0:segmentError/>
    <ns0:trxSetAckCode>A</ns0:trxSetAckCode>
    </ns0:XxmfiEdi997_AckLines>
    <ns0:XxmfiEdi997_AckLines>
    <ns0:lineId>37</ns0:lineId>
    <ns0:trxSetIdentCode>810</ns0:trxSetIdentCode>
    <ns0:trxSetControlNumber>0001</ns0:trxSetControlNumber>
    <ns0:segmentCode/>
    <ns0:segmentPosition/>the Element-329 of incoming source payload is mapped to trxSetControlNumber of target payload, the issue is obvious from the above XML data that trxSetControlNumber is always having the value 0001 for every occurence where as its expected to fetch the value of the element of its corresponding occurence not the first elements value.
    Please find below the xslt file code i used for mapping
    <ns0:XxmfiEdi997_AckHeadersCollection>
          <ns0:XxmfiEdi997_AckHeaders>
            <ns0:headerId>
              <xsl:value-of select='oraext:sequence-next-val("XXMFI_EDI_997_ACK_HEADERS_S","jdbc/MTSI-apps")'/>
            </ns0:headerId>
            <ns0:processFlag>
              <xsl:text disable-output-escaping="no">I</xsl:text>
            </ns0:processFlag>
             <ns0:xxmfiEdi997_AckLinesCollection>
              <xsl:for-each select="/ns1:Transaction-997/ns1:Loop-AK2">
                <ns0:XxmfiEdi997_AckLines>
                  <ns0:lineId>
                    <xsl:value-of select='oraext:sequence-next-val("XXMFI_EDI_997_ACK_LINES_S","jdbc/MTSI-apps")'/>
                  </ns0:lineId>
                  <ns0:trxSetIdentCode>
                    <xsl:value-of select="/ns1:Transaction-997/ns1:Loop-AK2/ns1:Segment-AK2/ns1:Element-143"/>
                  </ns0:trxSetIdentCode>
                  <ns0:trxSetControlNumber>
                    <xsl:value-of select="ns1:Segment-AK2/ns1:Element-329"/>
                  </ns0:trxSetControlNumber>
                  <ns0:segmentError>
                    <xsl:value-of select="/ns1:Transaction-997/ns1:Loop-AK2/ns1:Loop-AK3/ns1:Segment-AK3/ns1:Element-720"/>
                  </ns0:segmentError>
                  <ns0:trxSetAckCode>
                    <xsl:value-of select="/ns1:Transaction-997/ns1:Loop-AK2/ns1:Segment-AK5/ns1:Element-717"/>
                  </ns0:trxSetAckCode>
                </ns0:XxmfiEdi997_AckLines>
              </xsl:for-each>
            </ns0:xxmfiEdi997_AckLinesCollection>
          </ns0:XxmfiEdi997_AckHeaders>Is there something I am doing wrong in mapping or am I missing something here. Please suggest .
    Thanks in advance
    ~TK.

    Hi,
    In your xslt code within the for loop, for the trxSetIdentCode why are you using the xpath "/ns1:Transaction-997/ns1:Loop-AK2/ns1:Segment-AK2/ns1:Element-143"? It should be just "ns1:Segment-AK2/ns1:Element-143". Similar changes for segmentError and trxSetAckCode also should be done. Remove the '/ns1:Transaction-997/ns1:Loop-AK2/' part from your xpath expressions inside the for loop and try it.
    Sahay

  • ForEach Loop Container Mapping Variable From SSIS Package Not Working In SQL-Server StoredProcedure

    I have an SSIS package that uses a ForEach Loop Container to enumerate Excel Files in a dir. I also have a Task Flow that inserts data from those Excel files into SQL-Server.
    Im trying to insert the file names into a column into the same table in SQL-Server by using a mapping variable in my StoredProcedure.
    Im having trouble with my MappingVariable at the end of the script with red squigglies. The following is my StoredProcedure script.
    CREATE PROCEDURE [dbo].[Insert_F_STG_v2]
    -- Add the parameters for the stored procedure here
    @Hrs float,
    @Type nvarchar(100),
    @SN nvarchar(100),
    @Op nvarchar(100),
    @[USER::CurrentFileName]
    AS
    BEGIN
    SET NOCOUNT ON;
    INSERT INTO [CRM_RC].[dbo].[F_StgTbl]
    [Hrs],
    [Type],
    [SN],
    [Op],
    [Report_Date]
    VALUES
    @Hrs ,
    @Type,
    @SN,
    @Op,
    @[USER::CurrentFileName]
    END
    The last @[USER::CurrentFileName] in the Values block at the bottom of the script is the one giving me issues.
    The following is the error:
    Msg 102, Level 15, State 1, Procedure Insert_F_STG_v2, Line 95
    Incorrect syntax near 'USER::CurrentFileName'.

    This seems to be the solution, but get the following exception: 
    [Derived Column [2]] Error: The "Derived Column" failed because truncation occurred, and the truncation row disposition on "Derived Column.Outputs[Derived Column Output].Columns[Derived Column 1]" specifies failure on truncation. A truncation error occurred
    on the specified object of the specified component.
    AND:  [SSIS.Pipeline] Error: SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "Derived Column" (2) failed with error code 0xC020902A while processing input "Derived Column Input" (3). The identified component returned
    an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.  There may be error messages posted before this with more information about the failure.

  • Looping in message mapping

    Hello XI Gurus,
    I need your help in doing following mapping.
    The source ORDERS02 Idoc contains is fields like
    E1EDP01(segment) under this
       E1EDP19(segment)-QUALF(field) = Z18
       E1EDP19(segment)-QUALF(field)  = Z39
       E1EDP19(segment)-QUALF(field)  = Z39
       E1EDP19(segment)-QUALF(field)  = Z39
       E1EDP19(segment)-QUALF(field)  = Z39  
    and the Target structure is like this
    E1NTITM(segment) under this-
       BAUTL(field)
    we need to populate the E1NTITM segment in target system only when
    E1EDP19-QUALF = Z39 , so here i got the idea how to get the E1NTITM segement. But BAUTL field will be populate in each E1NTITM segment only when E1EDP19-QUALF = Z18. It means, in the source structure contains one
    E1EDP19-QUALF = Z18 and n number of E1EDP19-QUALF = Z39 fields. So E1NTITM segment will appear in the target n number of times and BAUTL field will be appear in each and every E1NTITM segment. if the source doesn't have
    E1EDP19-QUALF = Z18 field then BAUTL field could't be there in target E1NTITM segment. For this i just have an idea like, we need to loop the E1EDP01 segment to check if there is any E1EDP19-QUALF = Z18 field is there but i don't no how to do the looping. Please help me how to solve this problem.

    Rao,
    Based on your structure I created the logic, please find them below in the URL. If you think it's not correct, then reply back.
    <b>Mapping</b>
    http://www.flickr.com/photo_zoom.gne?id=1954590723&size=o
    http://www.flickr.com/photo_zoom.gne?id=1954590729&size=o
    <b>UDF</b>
    http://www.flickr.com/photo_zoom.gne?id=1954590957&size=o
    Just see the logic[ The UDF window belongs to SP14, so don't care] I believe u know how to create advanced UDF.
    I used two UDF, find the code below.
    <b>UDF - Generate</b>
    int z39cnt =0;
    int z18cnt =0;
    for(int i=0;i<a.length;i++)
    if(a<i>.equals("Z18"))
    z18cnt+=1;
    else if(a<i>.equals("Z39"))
    z39cnt+=1;
    if(z18cnt == 0)
    result.addSuppress();
    else
    for( int j=0;j<z39cnt;j++)
    result.addValue("BAUTL");
    result.addContextChange();
    <b>UDF - Generateroot</b>
    int z39cnt=0;
    for(int i=0;i<a.length;i++)
    if(a<i>.equals("Z39"))
    result.addValue("");
    <b>Results</b>
    http://www.flickr.com/photo_zoom.gne?id=1954590735&size=o
    http://www.flickr.com/photo_zoom.gne?id=1954590737&size=o
    If you find any difficulties in achieving the same then let me know.
    raj.

  • XSLT mapping for HL loop sequence S,O,I,O,I,O,I

    I am trying to use BPEL to map an EDI 856 ASN from the XML Gateway where the trading partner requires the following HL looping sequence; S,O,I,O,I,O,I. It is shipment, order, item, order, item etc.. Using the for each constructs what I get is S,O,O,O,I,I,I. Does anyone know of a way to do this in the XSLT mapper?

    Hi,
    You can try this by making use of preceding-sibling and following-sibling axes in XSLT..after S, u can put a
    <xsl:if test following-sibling::ns0:ReadDataFromOutput[ns0:segment='O']> and try same with rest of the segement.

  • Nested loop Mapping in XSLT

    Hi
    I am using this XSLT mapping with the source and target structure as same, since i need to include some constants in it.I am doing more than two nesting for loop. Since it is the same structure it looks simple. But i cannot produce the nested output.
    the XSL am using :
    <b><xsl:for-each select="products/vendor/product"></b>
      <xsl:element name="product">
      <xsl:value-of select="products/vendor/product" />
       <b>  <xsl:for-each select="products/vendor/product/attribute"></b>
             <xsl:element name="products/vendor/product/attribute">
             <xsl:value-of select="products/vendor/product/attribute" />
             <attribute operation="" attributeId="" name="" language="" endpointid="" xsi:type=""/>
             </xsl:element>
            <b> </xsl:for-each></b>
    </xsl:element>
    <b></xsl:for-each></b>
    Need the output like
    <product >
    <attribute name="ADA Compliant">Y</attribute>
    <attribute name="" type=" ">32.750</attribute>
    <attribute name="" type=" ">19.750 in</attribute>
    <attribute name="" type=" ">No</attribute>
    <attribute name="" type=" ">65.000</attribute>
    </product>
    I am not sure what is wrong in the XSLT. Any pointers on this.
    Regards
    Anandan
    Message was edited by:
            Anandan Loganathan

    Hi
    Have a look
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb983c1
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9692eb84-0601-0010-5ca0-923b4fb8674a
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/006aa890-0201-0010-1eb1-afc5cbae3f15
    Some scenarios
    /people/sap.user72/blog/2005/03/15/using-xslt-mapping-in-a-ccbpm-scenario
    /people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
    Thanks

Maybe you are looking for

  • Can't upgrade Photoshop Elements 9.0 to ANYTHING: unable to open Canon CR2 Raw files

    I will start this post w/ the comment that I am completely fed-up with Adobe, and am not surprised at the troubles its having considering how completely **** it's ancillary services on its products are. Outside of the actual editing capabilities of t

  • Ichat video preview not working in FCP

    I am attempting to work with a client utilizing the iChat Theater preview in Final Cut Pro. His Mobile.Me address is in my buddy list. I initiate the preview in FCP and it says that I need to invite a buddy, yet when the chat box pops up and I attemp

  • Message with internal table

    Hi, How am i gonna show the error generated here using the message class? Thanks  a lot!   LOOP AT i_messages WHERE type = c_error. *Show errors generated from i_messages     EXIT.   ENDLOOP.

  • Impossible to playback H.263 coded .mov

    When opening a movie clip coded with H.263 an ArrayIndexOutOfBoundsException occurs. The file used for the test has uncompressed audio so that cannot be the problem. When playing a movie clip coded with Cinepak there is no problem. Complete exception

  • Pcsuite does not recognise connected 6230

    I have a 6230 connected via infrared. I have confirmed connection via wireless link at 115.20 kbs but when I try to establish connection to PC suite it enters the connection wizard and gets stuck in the "Activate infrared connection" window. I encoun