Incrementing a variable in a loop

I'm trying to increment my text_item names with a "counter" in my code. Is there a way to do this in PL/SQL? I have 8 text_items I'm trying to fill with a text delimited file. Please see comment within code below.
loop
idxval:= instr( bigstr, ',' );
if idxval = 0 then
smlstr:= bigstr;
else
smlstr:= substr( bigstr, 1, idxval - 1 );
bigstr:= substr( bigstr, idxval + 1 );
end if;
-- increment :text_item name here (8-0) with idxval
:text_item := dbms_output.put_line( smlstr );
exit when idxval = 0;
end loop;
Thanks, Maggie

If you trying to concatenate values to a text_item you should do :
:BlockName_Text_Item := :BlockName_Text_Item || smlstr
It is no necessary use dbms_ouput in forms you just do
:BlockName_Text_Item := smlstr

Similar Messages

  • Problem while incrementing a variable in Jasper Reports

    Hi
    I am using Jasper Reports for designing reports. These reports will be used by my Java application.
    But there is problem while I am trying to increment a variable depending on some condition.
    Requirement: I have to display information about all the residents in a hospital in a single report. Resident information will be fetched from the XML file. When a resident ID is found in the XML, then the variable(resno) shoud be incremented. I have set the initial value to 1.
    Problem: Only for the first resident, resno is showing as 1. For all the remaining residents, its showing as 0 (zero).The variable 'resno' is not incrementing for each resident.
    Even the ResidentID is not null. All the ResidentID's exists in the XML file.
    Please find the code below.
    <variable name="resno" class="java.lang.Integer" incrementType="Group" incrementGroup="residentbrk" calculation="Count">
    <initialValueExpression><![CDATA[new Integer(1)]]></initialValueExpression>
    </variable>
    <group name="residentbrk" isStartNewPage="true">
    <groupExpression><![CDATA[$F{ResidentID}]]></groupExpression>
    <groupHeader>
    <band height="16">
    <textField hyperlinkType="None">
    <reportElement positionType="Float" x="0" y="-1" width="96" height="17"/>
    <textElement>
    <font isBold="true"/>
    </textElement>
    <textFieldExpression class="java.lang.String"><![CDATA[$R{residentno}]]></textFieldExpression>
    </textField>
    <textField hyperlinkType="None">
    <reportElement positionType="Float" x="96" y="-2" width="64" height="18"/>
    <textElement/>
    <textFieldExpression class="java.lang.Integer"><![CDATA[$V{resno}]]></textFieldExpression>
    </textField>
    </band>
    </groupHeader>
    </group>
    Could you please provide a solution for this.

    Not clear at all. May be like this
    declare
    v_temp varchar2(100);
    v_final number;
    begin
    --loop
    v_temp:='sun';
    v_temp:=translate(lower(v_temp), '1abcdefghijklmnopqrstuvwxyz', '1');
    dbms_output.put_line('Temp:'||v_temp);
    v_temp := v_temp || 'Mon5.1';
    v_temp:=translate(lower(v_temp), '1abcdefghijklmnopqrstuvwxyz', '1');
    dbms_output.put_line('Temp:'||v_temp);
    v_temp:= v_temp || 'Tue';
    v_temp:=translate(lower(v_temp), '1abcdefghijklmnopqrstuvwxyz', '1');
    dbms_output.put_line('Temp:'||v_temp);
    v_final:=to_number(v_temp);
    dbms_output.put_line('v_final'||v_final);
    --coalesce
    --end loop;
    end;
    /

  • Problem using local variable in event loop

    I have a state machine from which I want to monitor various controls, including "Start" and "Stop" buttons.  Not every state needs to monitor the controls.  At present, most states run timed loops.  In the first state that reads the front panel, I have an Event structure (inside a While loop) that monitors the various controls' Change Value events.  For numeric controls, I update variables (in shift registers) as needed.  The "Start" button is used to end the While loop controlling the Event structure, allowing the State to exit to the next state.
    My problem comes in subsequent states that employ this same idea.  Here, I put a Local Variable bound to the Start button and use the same code, but it frequently happens that when I enter this particular state, I cannot "turn on" the control -- I push the button, but it stays off.  Curiously, if it was On when I enter, I can turn it off, but then I'm stuck not being able to turn it on.
    I mocked up a very simply routine that illustrates this.  There are two sequences (corresponding to the two states).  Both use an Event loop with a local variable bound to my Stop button (really this is an LED control with custom colors).  I've deliberately moved the "initialization" (the declaration of the control in the block diagram) out of the Event loops -- putting it inside the first loop modifies the behavior in another strange way.
    Here's my thinking on how I would expect this to work:  The code outside Event Loop 1 should have little effect.  Assume the Stop button is initially Off.  You will "sit" in Event Loop 1 until you push the Stop button, changing its value to True; this value will be passed out of the Event case and cause the first While loop to exit.  You now enter the second sequence.  As I understand the Exit tunnel, it defaults to "False", so I'd expect to stay in the second Event loop until I turn the Stop button from On to Off, which will pass out a False, and keep me in the While for one more button push.  However, this doesn't happen -- I immediately exit, as though the "True" value of the Stop local variable is being seen and recognized by the Event loop (even though it hasn't changed, at least not in the context of this second loop).
    An even more curious thing occurs if I start this routine with the Stop button turned on.  Now I start in my Event loop waiting for a change, but this time the change will be from On to Off, which won't cause an exit from the frame.  This will be reflected by having the While loop count increment.  We should now be in the state of the example above, i.e. in an Event loop waiting for the control to be pushed again, and turned On.  However, clicking the control has no effect -- I cannot get it to "turn on".
    Where am I going astray in my thinking?  What is it about this method of doing things that violates the Labview paradigm?  As far as I can tell, what I'm doing is "legal", and I don't see the flaw in my reasoning, above (of course not -- otherwise I'd have fixed it myself!).  Note that because I'm using local variables inside Event loops (and I'm doing this because there are two places in my code where I want to do such testing), the Stop control is not latching (as required).  Is there something that gets triggered/set when one reads a latched control?  Do I need to do this "manually" using my local variable?
    I'll try to attach the simple VI that illustrates this behavior.
    Bob Schor
    Attachments:
    Simple Stop Conundrum.vi ‏14 KB

    altenbach wrote:
    Ravens Fan wrote:
    NEVER have multiple event structures that share the same events. 
    Actually, that's OK.  NOT OK is having multiple event structures in the same sequence structure.
    See also: http://forums.ni.com/ni/board/message?board.id=170&message.id=278981#M278981
    That's interesting.  I had always thought I read more messages discouraging such a thing rather than saying it was okay.  Your link lead me to another thread with this message. http://forums.ni.com/ni/board/message?board.id=170&message.id=245793#M245793.  Now that thread was mainly concentrating on registered user events which would be a different, but related animal. 
    So if you have 2 event structures they each have their own event queue?  So if you have a common event, one structure pulls it off its event queue and it does not affect the other structure's event queue?  I guess the inherent problem with this particular VI was that the second event structure locked the front panel.  Since the code never got to that 2nd event structure because the  first loop never stopped because the change was from true to false.  After reading your post and the others, I did some experimentation and turned off the Lock front panel on the 2nd structure, and that prevented the lockup of the program.
    Overall, the example VI still shows problems with the architecture and I think your answer should put the original poster on the right track.  I think as a rule I would probably never put the same event in multiple structures, I feel there are better ways to communicate the same event between different parts of a program,  but I learned something by reading your reply and about how the event structures work in the background.  Thanks.

  • How can I increment a variable in LabView ?

    Hello ..
    I'm trying to use LabVIEW to increment a variable, but I can't find the right way to do that !
    I need to declare a variable and assign zero as its value, then increment it by one each time a certain condition is met, and I need it to reset to zero after it reaches a certain value. It's easy to perform these steps using standard C language but here it looks complicated !
    Could someone explain the steps to do that ?
    Thanks!

    I guess trying to explain how to write a state machine would be difficult..
    It should take you 5 mins to implement the solution.  I post so late that it's probably too late for you.
    But here goes.
    Take a While loop with shift registers as shown in the image of an earlier post.  Place a Case Structure inside the loop.  You will need to use an enumerator (usually create a type def control).  Put 2 states into the enumerator:  reset, increment.  Wire the enumerator to the question mark of the Case Structure.  In the increment case of the Case Structure, you place the +1.  In the reset case you simply wire zero '0' as the proper type (dbl, U32, etc) to the right tunnel of the Case Structure.
    In the code somewhere... you need to set the logic to tell the state machine when to reset.  I don't recall reading what that was...  But in any case, you need another shift register to pass the next state to the Case Statement.  Or if that code is embedded into some other code, then it is probably not necessary.  But you will need someting like a selector to choose between Increment and Reset.  Also choose which of the 2 is the default state, probably any of the 2 for now.  The outcome of the logic to reset or increment is obviously wired to the middle terminal of the Select.
    Just curious, since you are in this predicament.  Did you tell your boss that you knew LabVIEW in order to get the job and now you are obviously stuck delivering a solution?

  • Difference between Pre and Post Incrementing a variable

    I have a problem understanding the nuances between i++ and ++i.
    I have run several loops and changed the position of the "++". I noticed that sometimes the out put differs and sometimes the output remains the same.
    Is there a rule of thumb as to whether a variable show be post or pre incremented?
    Thanks

    Thank you all.
    After I asked the question, I did a little research and found this (from JGuru shortcourse):
    Note that x++ and ++x are equivalent in standalone contexts where the only task is to increment a variable by one,that is, contexts where the ultimate evaluation is ignored:
    int x = 4;
    x++; // same effect as ++x
    System.out.println("x = " + x);
    This code produces the output:
    x = 5;
    The next part after this is:
    In the following context, the placement of the increment operator is important:
    int x = 4;
    int y = x++;
    int z = ++x;
    System.out.println(
    "x = " + x + " y = " + y + " z = " + z);
    This code produces the output:
    x = 6 y = 4 z = 6
    ======================================================================
    I thought the out put would be x = 4, y = 6, z = 4.
    I totally lost! How do I interpet this correctly?

  • Using variables in a loop

    Hello and thanks in advance!  I'm attempting to insert records into a temp table using a loop.  I have many declared variables that will be used as criteria in the query.  Since the variable are all named the same other than a ascending
    numberic to the name, how would I get a variable in a loop to substitute the "numberic" part of the variables? I've created some sudo sql for what I'm trying to achieve:
    Declare @Start1 as Date = '2014-01-01'
    Declare @Start2 as Date = '2014-15-01'
    Declare @Start3 as Date = '2014-18-01'
    Declare @i INT = 1
    WHILE @i < 20
         SELECT .... INTO #MyTemp ...
         WHERE OrderDate Like @Start + @i       --This is the line I cant seem to get working.
         SET @i = @i +1
    END

    >>You have just described a 1950's file system using punch cards (also called unit records) writing to a scratch tape with Autocoder. You have no idea how to write SQL or program in a declarative language. We do not sure temporary files or loops. The
    goal is to write one statement that does the task. We do not use local variables; we use expressions that compute their values.<<
    What are you talking about or your point? I dont ever remember asking about temporary files. Who is the 'We' you keep referring to?  why did you even bother posting with a negative and absolutely unhelpful reponse.
    >>That is called an “array” in procedural programming and a repeated group in RDBMS. It also violated First Normal Form (1NF). <<
    Wrong. I said that I created variables.  I did not say I created an array.  Also, you have no idea of what I was trying to accomplish. 
    >>
    If you truly do not care about ever being a good programmer, you can kludge this 1950's code with dynamic SQL. But I will use you as a bad example in my books :(  <<
    I have no idea who you are and take offense at your entire post attempting to tear me down.  Your arrogance and attitude appears to have grown with your forum points.  I'm still confused as to why somebody with your so-called expertise
    posted such an a$$#*%! comment.

  • Increment CHAR variable

    Hi,
    I'm a beginner in ABAP and I have a question..
    Is possible increment a char variable?
    for example I have varible:
    R001 and i want increment this variable till RZZZ..
    There is some solution or some function that i could use to do this?
    Thanks so much.

    Hi,
    please find starting & ending sequence numbers from R000 RZZZ
    000     001     002     003     004     005     006     007     008     009     00A     00B     00C     00D     00E     00F     00G     00H     00I     00J     00K     00L     00M     00N
    00O     00P     00Q     00R     00S     00T     00U     00V     00W     00X     00Y     00Z     010     011     012     013     014     015     016     017     018     019     020     021
    022     023     024     025     026     027     028     029     030     031     032     033     034     035     036     037     038     039     040     041     042     043     044     045
    046     047     048     049     050     051     052     053     054     055     056     057     058     059     060     061     062     063     064     065     066     067     068     069
    070     071     072     073     074     075     076     077     078     079     080     081     082     083     084     085     086     087     088     089     090     091     092     093
    094     095     096     097     098     099     01A     01B     01C     01D     01E     01F     01G     01H     01I     01J     01K     01L     01M     01N     01O     01P     01Q     01R
    01S     01T     01U     01V     01W     01X     01Y     01Z     02A     02B     02C     02D     02E     02F     02G     02H     02I     02J     02K     02L     02M     02N     02O     02P
    ZUM     ZUN     ZUO     ZUP     ZUQ     ZUR     ZUS     ZUT     ZUU     ZUV     ZUW     ZUX     ZUY     ZUZ     ZVA     ZVB     ZVC     ZVD     ZVE     ZVF     ZVG     ZVH     ZVI     ZVJ
    ZVK     ZVL     ZVM     ZVN     ZVO     ZVP     ZVQ     ZVR     ZVS     ZVT     ZVU     ZVV     ZVW     ZVX     ZVY     ZVZ     ZWA     ZWB     ZWC     ZWD     ZWE     ZWF     ZWG     ZWH
    ZWI     ZWJ     ZWK     ZWL     ZWM     ZWN     ZWO     ZWP     ZWQ     ZWR     ZWS     ZWT     ZWU     ZWV     ZWW     ZWX     ZWY     ZWZ     ZXA     ZXB     ZXC     ZXD     ZXE     ZXF
    ZXG     ZXH     ZXI     ZXJ     ZXK     ZXL     ZXM     ZXN     ZXO     ZXP     ZXQ     ZXR     ZXS     ZXT     ZXU     ZXV     ZXW     ZXX     ZXY     ZXZ     ZYA     ZYB     ZYC     ZYD
    ZYE     ZYF     ZYG     ZYH     ZYI     ZYJ     ZYK     ZYL     ZYM     ZYN     ZYO     ZYP     ZYQ     ZYR     ZYS     ZYT     ZYU     ZYV     ZYW     ZYX     ZYY     ZYZ     ZZA     ZZB
    ZZC     ZZD     ZZE     ZZF     ZZG     ZZH     ZZI     ZZJ     ZZK     ZZL     ZZM     ZZN     ZZO     ZZP     ZZQ     ZZR     ZZS     ZZT     ZZU     ZZV     ZZW     ZZX     ZZY     ZZZ
    My suggestion will be create a custom table and keep all possible combination numbers in it and use this table

  • Auto increment variable in foreach loop in ssis

    i know this has been asked N number of times, but still i have a question for you guys
    i have files sitting in FTP location
    i am loading the data from the files into tables (no issues)
    but i need to assign value to a particular column as -99999999 and then auto increment that number while loading the files into the database
    I cannot have auto increment for the that particular column
    should i use a derived column, script component, execute sql task?
    can somebody point me to the right direction
    if it were a single file, assigning the auto incremental number is easy, but with for each loop, i am not able to get the solution
    Thanks

    Hi Jack,
    To achieve your goal, you can use a Row Count Transformation in the Data Flow Task to get row count for each file, and then use an Execute SQL Task after the Data Flow Task to update the total row count variable. Supposing the variable used in the Row Count
    Transformation is InsertCount, the variable used to store the total row count is TotalInsertCount. We need to set the ResultSet of the Execute SQL Task to “Single row”, and the SQLStatement to:
    DECLARE @Insert_Count INT, @Total_Insert_Count INT
    SET @Insert_Count=?
    SET @Total_Insert_Count=?
    SET @Total_Insert_Count=@Total_Insert_Count + @Insert_Count
    SELECT R_Total_Insert_Count=@Total_Insert_Count
    Then, set the Parameter Mapping of the Execute SQL Task, we map variable InsertCount and TotalInsertCount to the parameters in the SQL statement respectively. In the ResultSet page of the Execute SQL Task, map the resultset to variable TotalInsertCount.
    Please refer to the following screenshot:
    Regards,
    Mike Yin
    TechNet Community Support

  • How do I increment a variable at the end of a loop to run it through the loop again?

    I'm new to LabVIEW programming and I'm trying to write a small program that just receives a lower and upper limit, and whether the user wants to increment or decrement the number. I can't figure out how to increment the number after the simple calculations have been done and to run through the loop again with the incremented number. Right now I'm using a while loop inside of a case structure where true decrements and false increments.

    Here are a few possibilities.
    Message Edited by altenbach on 12-05-2008 03:25 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    fractionaIncrement.png ‏8 KB

  • Is it possible to create variables with an incremented name in a for loop?

    I want to create a number of variables according to the following:
    MyClass var_1 = new MyClass();
    MyClass var_2 = new MyClass();
    MyClass var_3 = new MyClass();
    MyClass var_n = new MyClass();
    Is there any way to do this in a loop ? Such as
    for ( int iii = 0 ; iii < 10 , iii++ ) {
    MyClass var_(iii) = new MyClass();
    Thanks

    ArrayList<MyClass> list = new ArrayList<MyClass>();
    for(int i = 0; i < 10; i++){
    MyClass c = new MyClass();
    list.add(c);
    MyClass [] myClasses = new MyClass[list.size()];
    list.toArray(myClasses);
    //when use the MyClass instance, use the element of the myClasses array by the index, as myClasses[0],myClasses[1]

  • Assigning value to array type variable in a loop

    Hi
    I have a scenario in which i am assigning value from a array type variable(x) to the invoke variable of a database adapter. The variable x is exact replica of the invoke variable.
    My copy operation in assign activity looks like this-
    <copy>
    <from variable="Var" part="InputParameters"
    query="/ns7:InputParameters"/>
    <to variable="Invoke_call_XXDPI_EDI_852_PKG_InputVariable"
    part="InputParameters"
    query="/ns7:InputParameters *(* bpws:getVariableData('iterator') *)* "/>
    </copy>
    It is inside a while loop activity.
    PS *()* are square brackets
    But it is erroring out at run time.
    Does anybody has an alternate idea to assign value to an array type?.
    i have seen that while extracting value from an array type variable it works fine
    A similar kind of operation is shown below.
    <copy>
    <from variable="Var" part="InputParameters"
    query="/ns7:InputParameters *(* bpws:getVariableData('iterator') *)* "/>
    <to variable="Invoke_call_XXDPI_EDI_852_PKG_InputVariable"
    part="InputParameters"
    query="/ns7:InputParameters"/>
    </copy>
    Thanks
    Ayush
    Edited by: Ayush fujitsu on Aug 14, 2009 4:36 AM

    Hi Ayush
    I suppose you are getting some error like "source node returns multiple elements".
    In second case there is no problem because you are assigning *InputParameters[bpws:getVariableData('iterator')]* (+suppose InputParameters[1]+) to target. Here it works fine because you are fetching oonly 1 value from source and assigning it to the target.
    Now in first case you are saying copy InputParameters to target[1] suppose. You know that source is an array which contains multiple index so which index field from the source will be assigned to the target.
    Try your process with only 1 source value it will work but when multiple values will be there it will fail. You have to merge both the cases and it will look like
    *<copy>*
    *<from variable="Var" part="InputParameters"*
    query="/ns7:InputParameters ( bpws:getVariableData('iterator') ) "/>
    *<to variable="Invoke_call_XXDPI_EDI_852_PKG_InputVariable"*
    part="InputParameters"
    query="/ns7:InputParameters ( bpws:getVariableData('iterator') ) "/>
    *</copy>*
    And the easiest way to do this is by the transform activity as said above.
    Regards
    Suryaveer
    Edited by: Suryaveer on Aug 15, 2009 11:19 PM

  • XSL-How to get value of a variable from inside loop-- to the outside loop?

    Pls help
    hi im currently working on this xsl file..
    This works on generating a txt file,my problem right now is
    ' how can i get the value of a variable generated from the inside forloop,
    i have to get the total,sum value of this variables after performing the loop
    ***this is the for loop
    <xsl:for-each select="OutboundPayment">
    <xsl:variable name='id' select='generate-id(OutboundPayment)'/>
    <xsl:sort select="PaymentNumber/CheckNumber" data-type="text" />
    <xsl:variable name='PValue' select='format-number(100*PaymentAmount/Value,"0000000000000")'/>
    <xsl:value-of select='$id'/>
    <xsl:text>D</xsl:text>
    <xsl:value-of select='$DDate'/>
    <xsl:value-of select='$Batch'/>
    <xsl:text>3</xsl:text>
    <xsl:value-of select='format-number(PaymentNumber/PaymentReferenceNumber,"0000000000")'/>
    <xsl:value-of select='format-number(PayeeBankAccount/BankAccountNumber,"0000000000")'/>
    <xsl:value-of select='substring(Payee/Name,1,20)'/>
    <xsl:value-of select='$PValue'/>
    <xsl:variable name='Addend' select='concat($DDate,substring($DAcct,5,5),$Batch)'/>
    <xsl:variable name="LHash">
    <xsl:call-template name="GetHash">
    <xsl:with-param name="A1" select="$PValue" />
    <xsl:with-param name="A2" select="$Addend" />
    </xsl:call-template>
    </xsl:variable>
    <xsl:value-of select="concat('[',$LHash,']')" />
    <!--LHash*i have to get the total amount of this one from the outside loop /---->
    <xsl:call-template name='NewLine'/>
    </xsl:for-each>
    <!--I have to put in here the total value of that LHash/---->
    <!--This is the template on how to get the value of that variable in the inside loop/---->
    <xsl:template name="GetHash">
    <xsl:param name='A1'/>
    <xsl:param name='A2'/>
    <xsl:variable name='TwoSum' select='format-number($A1+$A2,"000000000000000")'/>
    <xsl:variable name='Weight' select='317191314191112'/>
    <xsl:call-template name="WDigit">
    <xsl:with-param name="Cnt" select="15"/>
    <xsl:with-param name="Sum" select="$TwoSum"/>
    <xsl:with-param name="Wgt" select="$Weight"/>
    <xsl:with-param name="Tot" select="0"/>
    </xsl:call-template>
    </xsl:template>
    <xsl:template name='WDigit'>
    <xsl:param name='Cnt'/>
    <xsl:param name='Sum'/>
    <xsl:param name='Wgt'/>
    <xsl:param name='Tot'/>
    <xsl:choose>
    <xsl:when test="$Cnt > 0">
    <xsl:variable name='Multip' select='substring($Wgt,$Cnt,1)'/>
    <xsl:variable name='Factor' select='substring($Sum,$Cnt,1)'/>
    <xsl:variable name='Prduct' select='$Multip$Factor'/>
    <!--xsl:value-of select="concat($Tot,'[',$Cnt,']')"/-->
    <!--xsl:value-of select="concat($Multip,'x',$Factor,'=',$Prduct)"/-->
    <!--xsl:call-template name='NewLine'/-->
    <xsl:call-template name="WDigit">
    <xsl:with-param name="Cnt" select="$Cnt - 1"/>
    <xsl:with-param name="Sum" select="$Sum"/>
    <xsl:with-param name="Wgt" select="$Wgt"/>
    <xsl:with-param name="Tot" select="$Tot+$Prduct"/>
    </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
    <xsl:variable name="Rem" select="$Tot mod 11"/>
    <xsl:variable name="Chk" select="11 - $Rem"/>
    <xsl:value-of select="format-number(concat($Tot,$Chk),'00000')"/>
    </xsl:otherwise>
    </xsl:choose>
    <xsl:template name='GetTotal'>
    </xsl:template>
    Thanks in advance for those who are willing to help.
    -Leighya

    It would have helped if you had posted your code as CODE but as it is, I could hardly read it. My guess about what you are asking is, if you want a template to return a value, just write that value to the result stream inside the template.
    If that wasn't what you were asking, then please post your code in a readable format.

  • Using the counter to create a input variable in while loops

    I'm using a loop to increment oscillator freq on my lock-in. I want this incrementation to be based off the loop counter. But when I do this, it gives me some kind of circular reference error. Can I make my own counter inside the loop instead? How? See the attached screen shot for details.
    Attachments:
    loop_problem.JPG ‏138 KB

    Hi Jesse,
    You can attach a copy of your vi instead of a screen capture, because the the screen capture is difficult to read. Unless there is confidential code, of course.
    The first thing I noticed is that there are some improperly wired vi's. I can't comment much because the screen capture was not clear.
    However, the "circular referrence error" means that you have a wire which exits a loop and re-enters it.
    If you need to pass a value back to the beginning of a loop, then use a Shift Register. Right click on the edge of a loop and select "Add Shift Register". It can be initialized by wiring a value (or control) to the input of the loop.
    -JLV-

  • Assigning  element (node) to variable in a loop

    Hello,
    I will get below input as <Request> .<instance></instance>.... <instance><instance>.. </Request>(see below) to my soa composite process. I have an instance.xsd . I have created an variable Instancexml element of type instance.xsd ,so Instancexml variable can hold all the values in order to utilize attributes,elements in my process.
    I have assigned a count for <instance> which is 2 in this case.
    I am looping through count and trying to assign first instance xml to Instancexml variable , but when I use this xpath, both instances are getting copied instead of one (when count=1)
    bpws:getVariableData('inputVariable','payload',concat('/ns1:Request/ns1:instance[',bpws:getVariableData('j'),']'))
    What is the correct xpath?
    <Request>
    <instance>
    <attribute name="abc" type="string"/>
    <attribute name="def" type="string"/>
    <element1 name="123" type="string">
    <element2 name="456" type="string">
    <element3 name="888" type="string">
    </instance>
    <instance>
    <attribute name="xyz" type="string"/>
    <attribute name="xxy" type="string"/>
    <element1 name="223" type="string">
    <element2 name="678" type="string">
    <element3 name="333" type="string">
    </instance>
    </Request>

    You shouldn't need to do a concat within the XQuery path parameter. Try the following:
    bpws:getVariableData('inputVariable','payload','/ns1:Request/ns1:instance[bpws:getVariableData(&quot;j&quot;)]')

  • Accessing variable in a loop

    I cannot access this variable from outside the loop. I know
    it has to be something very simple. When tracing the variable, it
    comes back as undefined. Please help.. Thanks

    when you prefix a variable with var, you make it local to the
    function that contains the variable.

Maybe you are looking for