Loop counter reset in parallel model ?

Hello,
i am using TestStand 3.1 with parallel model. There is a loop counter for each UUT in RunState.Root.Parameters.TestSocket.UUT.UUTLoopIndex. This increases with every loop that is done.
Now my problem is: If i start the NextUUT, this counter is not set to 0. It just increases.
Is there a different counter that i can use ? Or where can i get the information that the NextUUT button is pressed so that i can reset the counter manually ? Or is there another solution.
Thanks for Help.

Hi,
I don't completely understand, why you want to reset the UUTLoopIndex, because it shows the number of iterations per test socket to check how many uut's have been tested on each. However, you could reset the value with a simple statement before you start the tests. You could do this in the setup step group, e.g. with RunState.Root.Parameters.TestSocket.UUT.UUTLoopIndex = 0. You could add a message popup or evaluate an extra condition or so.
Kind regards,
Philippe Goetz,
Applications Engineer, National Instruments

Similar Messages

  • Resetting a for loop counter and restarting the computation

    I have a while loop nested inside a for loop to do a calculation of a model. 
    Lets say I am on the for loop counter 4. Suppose I wanted to keep track of the number of iterations on one the while loop, and if it exceeded a certain number say 100, exit the while loop.  I am doing this to avoid my model calculation being stuck at a spot due to optimization issues. I now want to restart the calculations of for loop counter 4. 
    Is there a way to do this in labview? 
    Solved!
    Go to Solution.

    Well first of all, if you are going to restart the loop with the same program inside it after it got stuck is it not just going to get stuck again creating a permanent loop in the code? Would you not just want to move on and have some sort of identifier that one of the for-loops got stuck?
    But I would recommend simply nesting your while-loop inside of another while loop, then connect the exit for the out while-loop to some variable from the inner while-loop, so if the optimization did not occur properly then it simply repeats the inner while-loop.
    Although I stick by my thoughts that you will just end up in a permanent loop if the optimization fails the first time.

  • SequenceFileUnload in TestStand 4.0 Parallel Model

    Has anyone experienced a problem when updating to TestStand 4.0 with the SequenceFileLoad and SequenceFileUnload callbacks?  I’m using the parallel process model configured for 8 threads and in earlier versions of TestStand have had no problems placing my hardware initialization steps in the SequenceFileLoad callback and the cleanup steps that release hardware references, in the SequenceFileUnload.   It seems very random that sometimes when I close my sequence, the Unload steps are executed.  Sometimes they only run if I select File->Unload All Modules or close TestStand. 
    Is there a flag in TestStand that I can use to trigger the Unload steps or possibly a better place in the parallel model to place my hardware cleanup?  I don’t want to release and have to reinitialize hardware references with each loop so any cleanup steps will need to be done once after all parallel threads are finished.

    Most of the time people do this in the Process Setup Callback and Process Cleanup Callback.  Those are process model callbacks that you can override from your client sequence.  They are probably better to use than the engine callbacks (SequenceFileUnload and SequenceFileLoad).  They get executed before and after the looping respectively.
    If you open the process model you'll see where they get called.  Process Setup Callback is in the Setup step group and Process Cleanup Callback is in the Cleanup step group.
    Regards,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • When to use parallel models?

    I am using TestStand to control test execution in a thermal chamber. I am unsure which process model best suits my needs (sequential, parallel, or batch). My requirements are as follows:
    Up to 4 UUTs will be tested using a single test system. Each UUT shares assets in the test system. An entire sequence of tests will be run repetitively on each unit for a period of 24 hours. Within the 24 hour period, a single control signal is received from the thermal chamber indicating when tests should be run. (run for two hrs, soak for two hrs; run for two hrs, soak for two hrs �). Typically (prior to using TestStand) the test controller would run all tests on UUT#1, then all tests on UUT#2, then all tests on UUT#3, and so on. At the completion o
    f this cycle, testing for UUT#1 would occur again. Each UUT has its own data report generated.
    I know the parallel process model allows for the removal and/or addition of UUTs at any time during the test sequnce. Although that is a nice feature, it is not a necessity.
    I would appreciate some advice on how to handle this situation. How can I affect the �infinite looping� of an entire test sequence for this multi-UUT environment?

    Maz,
    in the TestStandI course they stated that the serial model is for serial testing of one UUT after the other. The parallel model could somehow be assumed as multiple serial models running in parallel. The batch model is somehow inbetween or extra. It handles the test of a whole batch of UUTs in parallel, where there are some things to be tested in common.
    Of course everything can be coded in every process model, but this would give up a lot of the built-in comfort.
    In your case I would choose the parallel model, except there are some steps that need to be done on the whole batch at the same time. Consider some UUTs that must all pass a voltage test where you have just one DMM, and must be cooled down when all are done. This would be a batch model.
    HTH and Greetin
    gs from Germany!
    LuI

  • Help with the Parallel Model configuration

    This is my first time posting, but I am a long time reader....
    First off, I would consider my Teststand knowledge level as high novice to low intermidiate. I created  a test sequence using in Teststand which calls labview vi's. My test sequence tests 5 units at a time in a parallel model (parallel model sequence). Functionally, everything runs great in single pass and looping. However, here is my issue:
    When selecting "Test UUT's", it brings up a window that asks for the serial number for each of the five stations. The operator then needs to enter a serial number for each and press okay to proceed. This setup is not valid for what I am doing. My test fixture has a button at each of the 5 stations. The user is to push the button to start the test (connects to a DAQ). Then, the serial number is read from the UUT and populated in the report.
    How would I go about reconfiguring this? I am not looking for someone to solve my problems for me, I just need a little direction. I looked at the parallel model sequence and I can't figure out where to go with it.
    Please help,
    Ryan
    Teststand 4.2
    Labview 2009
    Solved!
    Go to Solution.

    No problem Ryan,
    When you are done here you will be a pro.  
    Here is a link that talks about callbacks and how overriding them works: http://zone.ni.com/devzone/cda/tut/p/id/6605
    The PreUUT will be a Model Callback.
    One thing I should point out- There is a huge difference between the Batch Model and the Parallel Model.  People tend to get them confused and sometimes use the wrong when the other one is a better fit for their architecture.  They way I think about it is like a race track.  Each car on the track represents a different test socket.  One time around the track represents a full test.  Pretend the race is completed by teams of cars.  Each team can only race one car for one lap (sorta like a relay).  The team would represent the available test fixture for the next UUT and the car would be the UUT. Here's how the race would work with each model:
    Batch Model-  Let's say there are 2 available spots in the race so we have 2 teams of 5 cars each.  Both of the teams 1st cars would line up at the starting line.  The gun would go off and each car would take off.  Let's say team 1's car gets around the lap first.  Before they can start their 2nd car they have to wait for team 2's 1st car to get around the track as well.  Then both team's 2nd cars would line up and continue the same as the first go around and so on until all 5 cars had raced.
    Parallel Model-  In the same car scenario as the Batch Model both of the team's 1st cars would line up and the gun would go off and they would go.  However, this time if team 1's car gets around the track they can immediately send their second car without waiting for Team 2's 1st car.  In fact all 5 of team 1's cars could be finished before team 2's 1st car even finishes it's lap.
    Not sure if you are a fan of analogies but they work for me. In short-
    Batch Model- Everything in that set of test sockets must start and stop at the same time.
    Parallel Model- Each test socket is independant of any other test sockets.
    I'm picturing your scenario where you have 5 different stations that will be running independantly of each other and trying to figure out if you would want the Batch behavior or the Parallel behavior.  Or..... Why wouldn't you just use the sequential model on each station and deploy your sequence to each station?  Maybe you can describe your setup in a little more detail and we could come up with a better solution.
    How does the one station know that the others have the Go button pushed?
    Regards, 
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • Creating a custom UUT dialog for the parallel model

    Hello,
    I am attempting to customize the parallel process model in order to (amongst other things) present a different UUT info dialog.  (The default one defined in modelsupport2.dll only presents a single "Serial number" field where I need numerous other ones.)  Because I am not familiar with CVI (and don't have the development tools for it), I was hoping to create an ActiveX DLL in Visual Basic, or a .NET assembly to manage a slightly more complex version of the UUT info dialog...  While I am sure it would be great fun to fumble with all the complexities of this until it shows some semblance of proper functionality I am hoping there may be some resources available online that would demonstrate how one would go about doing this kind of thing.  I've seen LabVIEW code that provides a different UUT dialog, but it was based on the sequential model which circumvents the most complex issues such as synchronizing the dialog with the TestStand threads, etc.  Any pointers would be greatly appreciated.
    Thanks!

    I am just posting this in case anyone else runs into the same sort of requirement.  The attached zip file contains the source for a .NET assembly that is the beginnings of a VB .NET replacement for the parallel UUT dialog of the modelsupport2 DLL.  I don't want to write an epic here, so the general idea is that the parallel model sequence is modified to make calls into this assembly instead of the modelsupport2.dll component.  But you can't just disable the dialog by setting the ShowUUTDlg boolean to false - that will completely remove the consumer loop in the ProcessDialogRequests sequence which the .NET assembly is trying to send requests to.  I've attached the modified ParallelModel.seq in case anyone's interested.
    Note that there are still significant problems with this and it is provided as-is.  In particular, if you attempt to break and step through the parallel model sequence after the dialog has been initialized, you will not be able to continue - the main thread will hang until you restart TestStand.  With a little more thread mgmt, that could be fixed.  If nothing else, it is useful code to look at if you need to enqueue items from a .NET assembly into a queue defined in a TestStand sequence.
    If you can afford to use the existing dialog as-is, and then add additional info gathering to the main sequence, that is clearly easier.  (That will be OK for my purposes so that is what I'll do.)  However, if you need to have one custom dialog that manages everything in the parallel model, this is the kind of code you should expect to need.
    Hopefully that helps somebody.  There is not much info out there about integrating .NET at this level.
    Attachments:
    CustomUUTDialog.zip ‏117 KB
    ParallelModel.seq ‏430 KB

  • What is the best way to open close and pass instrument handles from labview in teststand parallel model?

    I have a number of test systems that use a parallel model with labview. We have a good number of instruments(PXI).
    What is the prefered method for open,closing and passing instrument handles in teststand using labview? 
    Solved!
    Go to Solution.

    Hi,
    No, Below is a bit from the Session Manager Help
    Currently, Session Manager supports the following instrument session types:
    IVI Sessions—Use an IVI session to obtain the C-based instance handle for an IVI logical or virtual instrument name. NI Session Manager does not support IVI-COM drivers at this time. When IVI-COM drivers are available, you can use an IVI session to obtain an ActiveX interface reference to an IVI-COM driver.
    VXIplug&play Sessions—Use a VXIplug&play session to obtain a C-based instance handle for a VXIplug&play logical or virtual instrument name. Configure VXIplug&play names in the <VXIplug&play directory>\<Platform directory>\NISessionMgr.ini file.
    VISA Sessions—Use a VISA instrument session to obtain a C-based viSession handle to a VISA resource or logical name. Configure VISA logical names in the <VXIplug&play directory>\<Platform directory>\NISessionMgr.ini file.
    Custom Sessions—Use a custom session to create a data container object that shares ActiveX objects you create or other data between software components you write. Use the Attach and Get methods to attach data to and retrieve data from a session. A custom session does not initialize, close, or own an instrument handle. The data you share with a custom session does not have to be instrumentation related. You can create a custom session with any name you request.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • UDF Using Dynamic Configuration for Counter Reset

    Hi All,
    In an Idoc to file scenario we want to have counter option at the end of the file.we are using NFS so that we wil not face any problem of counter reset on a j2ee restart
    But when the counter turns 999999 it has to be reset to 0000001
    So we are trying to dynamically create a file name using the counter and check whether it has reached 999999 then resetting back . I had written a code for the same but it is throwing an error while mapping and activating.
    UDF CODE is below
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION) ;
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName") ;
    String FileName = conf.get(key) ;
    int inc = 1 ;
    String temp = FileName.substring(10,6);
    String temp1 = FileName.substring(0,10);
    Integer seqNo = Integer.parseInt(temp) ;
    if(seqNo == 0 || seqNo == 999999) {
    seqNo = new Integer(inc) ;
    else {
    int num = seqNo.intValue() + inc ;
    seqNo = new Integer(num) ;
    container.setParameter("seqNo", seqNo);
    String File_Name = temp1 + Integer.toString(seqNo);
    conf.put(key, File_Name);
    return File_Name;
    ERROR it is throwing
    'class' or 'interface' expected public String Decimal$(String Sample,Container container){ ^ /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpath_resolver/Map76d12330b43811df8c1500e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_TRGT_.java:127: 'class' or 'interface' expected }
    So can anyone please advice.

    Hi Stefan,
    I removed the last }
    But stil it is throwing the below error:
    Activation of the change list canceled Check result for Message Mapping MM_Sample_to_Trgt | :  Starting compilation  Source code has syntax error:  /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpath_resolver/Map8e67b780b44111dfbc4100e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_Trgt .java:98: FileName is already defined in File$(java.lang.String,com.sap.aii.mappingtool.tf3.rt.Container) String FileName = conf.get(key) ; ^ /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpathresolver/Map8e67b780b44111dfbc4100e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_Trgt .java:102: incompatible types found : int required: java.lang.Integer Integer seqNo = Integer.parseInt(temp) ; ^ /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpathresolver/Map8e67b780b44111dfbc4100e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_Trgt .java:103: operator == cannot be applied to java.lang.Integer,int if(seqNo == 0 || seqNo == 999999) { ^ /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpathresolver/Map8e67b780b44111dfbc4100e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_Trgt .java:103: operator == cannot be applied to java.lang.Integer,int if(seqNo == 0 || seqNo == 999999) { ^ /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpathresolver/Map8e67b780b44111dfbc4100e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_Trgt .java:111: cannot resolve symbol symbol : method toString (java.lang.Integer) location: class java.lang.Integer String FileName = temp1 + Integer.toString(seqNo);
    Edited by: mallavarapu soundarya on Aug 30, 2010 4:44 PM

  • A special Rendezvous that works on subsets of processes in the parallel model

    I have a parallel model test that works great on 14 UUTs so far, but now I must write some sequences where the processes have to share hardware two at a time. I need to pair up the processes like (0,1), (2,3), (4,5), etc. and have a Rendezvous operate on them two at a time like this:
    Processes (0,1) operate in parallel.
    Processes (2,3) operate in parallel.
    Processes (4,5) operate in parallel.
    And so on....
    Given enough time, maybe I could write that programmatically in TestStand; but I hope TestStand has a built-in Rendezvous for subsets of processes, or something else to do that. Does such a thing exist?

    bmihura wrote:
    OK I tried your pairing up idea with six processes (three seperate Rendezvous, one for each pair), but they all still ran in parallel. I'd like for one pair to execute at a time while locking out the others. This is because my system has two electronic loads (and two of many other things) that the six UUTs must share.
    Ok, then what you proposed before (a separate rendezvous for each pair of threads) is not the correct way to synchronize things. A rendezvous just causes threads to block until the specified number of threads reaches the rendezvous point. You have three independent pairs of threads running in parallel. If that is not what you want, then using rendezvous like this isn't the right approach.
    Please describe in more detail the entire flow of execution you are looking for. At what scope do you want the other threads to be blocked? Do you want each pair of threads to run all tests before any other threads can run? Do you want this only around certain steps? or Group of steps? Also, why do you want the threads to be paired? The most straightforward way I can think of to allocate two of a resource is to not care about which thread is using it, but to only allow two threads at a time, they don't necessarily have to be in pairs or even the same two threads every time. Do you really need the threads to be paired?
    One of the simplest TestStand specific ways to allocate resources is to use the auto-schedule step types. They allow you to define blocks of code which require specific resources and then automatically run those blocks of code when those resources are available. I recommend you read the documentation for these step types and see if that sounds like it will work for you.
    Another relatively simply way to synchronize access to a fixed number of resources among many threads is with a semaphore. A semaphore allows a certain number of threads through at a time, and blocks other threads until one of the ones using the resource release their acquisition of the semaphore. If the resources involved are more complicated though, I think you are better off using the auto-scheduler step types.
    Hope this helps,
    -Doug

  • LabVIEW 6.1 If For Loop count terminal is zero then value going through the loop is not passed on to the output of the loop

    Hello, one of our customers just encountered an execution error in a vi running under LabVIEW 6.1, which doesn't exist under LabVIEW 5.1 or 6.01. I have a simple vi that has two encapsulated For Loops. Two string arrays go in, one goes out of the outer loop. Inside the outer loop the first array is indexed. The string which results from this indexing is compared with all other strings from the second string array in the inner loop. If it matches one of the strings of the second array, it is not outputted, otherwise this string goes through the inner For Loop to the output of the inner loop and from there to the output of the outer loop. The count
    terminal of the outer/inner loop is connected to the Array Size of the first/second string array. If the second array is empty, that means that the element in test from the first arry cannot match anything from the second array, so the element in test is send to the output of the inner loop and from there to the output of the outer loop. This works fine in LabVIEW 5.1 and 6.01, but NOT in LabVIEW 6.1. In LabVIEW 6.1 the inner loop is never executed if the count value is zero (which is correct), but the data line running through the loop is not executed either, which is different to what LabVIEW 5.1 and 6.01 do. There, the input string is sent to the output of the inner loop correctly even if the loop counter is zero. The solution is easy - I just have to connect the output of the outer loop to the data line BEFORE it enters the inner loop. But: I don't know if this is a LabVIEW 6.1 bug or if it is supposed to be a feature, but it brings some incompatibility in programming between the
    different LabVIEW versions.
    Best regards,
    Gabsi

    Hi,
    When a for-loop runs zero times, all outputs are 'undefined' (and should
    be).
    Besides, how would LV know what the output of a not executed routine should
    be?
    It might be handled differently in LV5 and LV6, which is unfortunate. In
    both cases, the result is undefined.
    It's not a bug. It's just something that should be avoided in any LV
    version.
    > The solution is easy - I just have to connect the
    > output of the outer loop to the data line BEFORE it enters the inner
    > loop. But: I don't know if this is a LabVIEW 6.1 bug or if it is
    In some cases this does the trick. But if the data is changed in the inner
    loop, this will effect the results if the N is not zero.
    Technically, I think the output in this construction is also 'undefined'.
    But LV handles this as expected / desired.
    Another solution is to use a shift register. If N is zero, the input is
    directly passed through to the output.
    Regards,
    Wiebe.
    "Gabs" wrote in message
    news:[email protected]...
    > LabVIEW 6.1 If For Loop count terminal is zero then value going
    > through the loop is not passed on to the output of the loop
    >
    > Hello, one of our customers just encountered an execution error in a
    > vi running under LabVIEW 6.1, which doesn't exist under LabVIEW 5.1 or
    > 6.01. I have a simple vi that has two encapsulated For Loops. Two
    > string arrays go in, one goes out of the outer loop. Inside the outer
    > loop the first array is indexed. The string which results from this
    > indexing is compared with all other strings from the second string
    > array in the inner loop. If it matches one of the strings of the
    > second array, it is not outputted, otherwise this string goes through
    > the inner For Loop to the output of the inner loop and from there to
    > the output of the outer loop. The count terminal of the outer/inner
    > loop is connected to the Array Size of the first/second string array.
    > If the second array is empty, that means that the element in test from
    > the first arry cannot match anything from the second array, so the
    > element in test is send to the output of the inner loop and from there
    > to the output of the outer loop. This works fine in LabVIEW 5.1 and
    > 6.01, but NOT in LabVIEW 6.1. In LabVIEW 6.1 the inner loop is never
    > executed if the count value is zero (which is correct), but the data
    > line running through the loop is not executed either, which is
    > different to what LabVIEW 5.1 and 6.01 do. There, the input string is
    > sent to the output of the inner loop correctly even if the loop
    > counter is zero. The solution is easy - I just have to connect the
    > output of the outer loop to the data line BEFORE it enters the inner
    > loop. But: I don't know if this is a LabVIEW 6.1 bug or if it is
    > supposed to be a feature, but it brings some incompatibility in
    > programming between the different LabVIEW versions.
    > Best regards,
    > Gabsi

  • Using FOR .. LOOP counter in handling of PL/SQL procedures with nest. table

    Hi all!
    I'm learning PL/SQL on Steve Bobrovsky's book (specified below sample is from it) and I've a question.
    In the procedure of specified below program used an integer variable currentElement to get reference to the row of nested table of %ROWTYPE datatype.
    Meanwhile, the program itself uses a common FOR .. LOOP counter i.
    DECLARE
    TYPE partsTable IS TABLE OF parts%ROWTYPE;
    tempParts partsTable := partsTable();
    CURSOR selectedParts IS
      SELECT * FROM parts ORDER BY id;
    currentPart selectedParts%ROWTYPE;
    currentElement INTEGER;
    PROCEDURE printParts(p_title IN VARCHAR2, p_collection IN partsTable) IS
      BEGIN
       DBMS_OUTPUT.PUT_LINE(' ');
       DBMS_OUTPUT.PUT_LINE(p_title || ' elements: ' || p_collection.COUNT);
       currentElement := p_collection.FIRST;
       FOR i IN 1 .. p_collection.COUNT
       LOOP
        DBMS_OUTPUT.PUT('Element #' || currentElement || ' is ');
         IF tempParts(currentElement).id IS NULL THEN DBMS_OUTPUT.PUT_LINE('an empty element.');
         ELSE DBMS_OUTPUT.PUT_LINE('ID: ' || tempParts(currentElement).id || ' DESCRIPTION: ' || tempParts(currentElement).description);
         END IF;
        currentElement := p_collection.NEXT(currentElement);
       END LOOP;
    END printParts;
    BEGIN
    FOR currentPart IN selectedParts
    LOOP
      tempParts.EXTEND(2);
      tempParts(tempParts.LAST) := currentPart;
    END LOOP;
    printParts('Densely populated', tempParts);
    FOR i IN 1 .. tempParts.COUNT
    LOOP
      IF tempParts(i).id is NULL THEN tempParts.DELETE(i);
      END IF;
    END LOOP;
    FOR i IN 1 .. 50
    LOOP
      DBMS_OUTPUT.PUT('-');
    END LOOP;
    printParts('Sparsely populated', tempParts);
    END;
    /When I've substituted an INTEGER global variable with such FOR .. LOOP counter, an APEX have returned an error "ORA-01403: no data found".
    DECLARE
    TYPE partsTable IS TABLE OF parts%ROWTYPE;
    tempParts partsTable := partsTable();
    CURSOR selectedParts IS
      SELECT * FROM parts ORDER BY id;
    currentPart selectedParts%ROWTYPE;
    PROCEDURE printParts(p_title IN VARCHAR2, p_collection IN partsTable) IS
      BEGIN
       DBMS_OUTPUT.PUT_LINE(' ');
       DBMS_OUTPUT.PUT_LINE(p_title || ' elements: ' || p_collection.COUNT);
       FOR i IN 1 .. p_collection.COUNT
       LOOP
        DBMS_OUTPUT.PUT('Element is ');
         IF tempParts(i).id IS NULL THEN DBMS_OUTPUT.PUT_LINE('an empty element.');
         ELSE DBMS_OUTPUT.PUT_LINE('ID: ' || tempParts(i).id || ' DESCRIPTION: ' || tempParts(i).description);
         END IF;
       END LOOP;
    END printParts;
    BEGIN
    FOR currentPart IN selectedParts
    LOOP
      tempParts.EXTEND(2);
      tempParts(tempParts.LAST) := currentPart;
    END LOOP;
    printParts('Densely populated', tempParts);
    FOR i IN 1 .. tempParts.COUNT
    LOOP
      IF tempParts(i).id is NULL THEN tempParts.DELETE(i);
      END IF;
    END LOOP;
    FOR i IN 1 .. 50
    LOOP
      DBMS_OUTPUT.PUT('-');
    END LOOP;
    printParts('Sparsely populated', tempParts);
    END;
    /When I've tried to handle this code in SQL*Plus, the following picture have appeared:
    Densely populated elements: 10
    Element is an empty element.
    Element is ID: 1 DESCRIPTION: Fax Machine
    Element is an empty element.
    Element is ID: 2 DESCRIPTION: Copy Machine
    Element is an empty element.
    Element is ID: 3 DESCRIPTION: Laptop PC
    Element is an empty element.
    Element is ID: 4 DESCRIPTION: Desktop PC
    Element is an empty element.
    Element is ID: 5 DESCRIPTION: Scanner
    Sparsely populated elements: 5
    DECLARE
    ERROR at line 1:                                 
    ORA-01403: no data found                         
    ORA-06512: at line 14                            
    ORA-06512: at line 35What's wrong in code(or what I have not understood)? Help please!

    942736 wrote:
    What's wrong in code(or what I have not understood)? Help please!First code. You have collection of 10 elements:
    1 - null
    2 - populated
    3 - null
    4 - populated
    5 - null
    6 - populated
    7 - null
    8 - populated
    9 - null
    10 - populated
    Then you delete null elements and have 5 element collection
    2 - populated
    4 - populated
    6 - populated
    8 - populated
    10 - populated
    Now you execute:
    printParts('Sparsely populated', tempParts);Inside procedure you execute:
    currentElement := p_collection.FIRST;
    This assingns currentElement value 2. Then procedure loops 5 times (collection element count is 5). Element 2 exists. Inside loop procedure executes:
    currentElement := p_collection.NEXT(currentElement);
    which assigns currentElement values 4,6,8,10 - all existing elements.
    Now second code. Everything is OK until you delete null elements. Again we have:
    2 - populated
    4 - populated
    6 - populated
    8 - populated
    10 - populated
    Again you execute:
    printParts('Sparsely populated', tempParts);Now procedure loops 5 times (i values are 1,2,3,4,5):
    FOR i IN 1 .. p_collection.COUNT
    Very first iteration assingns i value 1. And since collection has no element with substript 1 procedure raises no data found.
    SY.

  • Error in sql query as "loop has run more times than expected (Loop Counter went negative)"

    Hello,
    When I run the query as below
    DECLARE @LoopCount int
    SET @LoopCount = (SELECT Count(*) FROM KC_PaymentTransactionIDConversion with (nolock) Where KC_Transaction_ID is NULL and TransactionYear is NOT NULL)
    WHILE (
        SELECT Count(*)
        FROM KC_PaymentTransactionIDConversion with (nolock)
        Where KC_Transaction_ID is NULL
        and TransactionYear is NOT NULL
    ) > 0
    BEGIN
        IF @LoopCount < 0
            RAISERROR ('Issue with data in KC_PaymentTransactionIDConversion, loop has run more times than expected (Loop Counter went negative).', -- Message text.
                   16, -- Severity.
                   1 -- State.
    SET @LoopCount = @LoopCount - 1
    end
    I am getting error as "loop has run more times than expected (Loop Counter went negative)"
    Could any one help on this issue ASAP.
    Thanks ,
    Vinay

    Hi Vinay,
    According to your code above, the error message make sense. Because once the value returned by “SELECT Count(*)  FROM KC_PaymentTransactionIDConversion with (nolock) Where KC_Transaction_ID is NULL and TransactionYear is NOT NULL” is bigger than 0,
    then decrease @LoopCount. Without changing the table data, the returned value always bigger than 0, always decrease @LoopCount until it's negative and raise the error.
    To fix this issue with the current information, we should make the following modification:
    Change the code
    WHILE (
    SELECT Count(*)
    FROM KC_PaymentTransactionIDConversion with (nolock)
    Where KC_Transaction_ID is NULL
    and TransactionYear is NOT NULL
    ) > 0
    To
    WHILE @LoopCount > 0
    Besides, since the current query is senseless, please modify the query based on your requirement.
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Storing data in a new excel sheet for each loop count

    I have a data acquisition code that takes data from the oscilloscope and saves it in an excel file.
    The oscilloscope has to take data at different instants(at each loop count). At each instant, the data gets appended to the same excel sheet. I just wanted to know if there is a way so that each time the data gets stored in a new excel sheet......
    If I run the vi again, the data is stored in a new excel sheet. But in a single run of the vi, all the data is always stored in a single excel sheet. Can anyone please help me with this??
    Thanx. 

    i have used write to measurement file.
    An image of a part of the code is attached.
    thanx... 
    Attachments:
    abc.jpg ‏25 KB

  • Reseting Table Data Model

    i have created JTREE consisting of all the table name and columns of tables present in Database .Now upon clicking a Specific table i want to display the Structure of database table on the right side of Split pane .
    Problem i am facing , i am not able to reset thetJTable data model.when i click second time to get the table structure , the Jtable is appearing under the previous one,...concatinating with the result of previous selection .
    here is my code
    ???public class DatabaseTree implements TreeSelectionListener
         static JTree tree;
         static DefaultMutableTreeNode list,col,top;
         static JTable table;
         static  DefaultTableModel default_table;
          static Vector column = new Vector();
         static Vector data = new Vector();
          static String url = "jdbc:oracle:thin:@192.168.0.149:1521:xe";
          static String user = "compiere";
          static String password = "compiere";
          static Connection conn;
          static Statement stmt,stmt2 ;
          static Statement stmt1 ;
          static JSplitPane splitPane;
         static JScrollPane treescroll,jtablescroll;
         DatabaseTree()
           top =new DefaultMutableTreeNode("Compiere Database Tables");
          tree = new JTree(top);
          tree.setRootVisible(true);
          table = new JTable();
    treescroll = new JScrollPane(tree);
    jtablescroll = new JScrollPane(table,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,treescroll, jtablescroll);
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(200);
    //Provide minimum sizes for the two components in the split pane.
    Dimension minimumSize = new Dimension(100, 50);
    treescroll.setMinimumSize(minimumSize);
    jtablescroll.setMinimumSize(minimumSize);
    ////Provide a preferred size for the split pane.
    splitPane.setPreferredSize(new Dimension(400, 200));
    tree.addTreeSelectionListener(this);
    try
       Class.forName("oracle.jdbc.driver.OracleDriver");
       conn = DriverManager.getConnection(url,user, password);
       stmt = conn.createStatement();
       stmt1 = conn.createStatement();
         String sql =("select table_name from user_tables");     
         ResultSet rs=stmt.executeQuery(sql);
         ResultSet rs1;
          while(rs.next())
         list = new DefaultMutableTreeNode(rs.getString("TABLE_NAME"));
        top.add(list);
         rs1=stmt1.executeQuery("Select column_name from user_tab_cols where table_name ='"+ rs.getString("TABLE_NAME")+"'");
         while (rs1.next())
              col= new DefaultMutableTreeNode(rs1.getString("column_name"));
              list.add(col);
        catch(Exception e1)
         System.out.println("errors "+ e1);
      public static void main(String[] args)
         JFrame  frame = new JFrame("Database Tree Structure");
       DatabaseTree dd=new DatabaseTree();
       frame.getContentPane().add(dd.getSplitPane());
       frame.setSize(450,450);
       frame.setVisible(true);
    public JSplitPane getSplitPane() {
            return splitPane;
    public void valueChanged(TreeSelectionEvent e) {
         // TODO Auto-generated method stub
         onSelectAction(e);
    private void onSelectAction(TreeSelectionEvent e) {
         // TODO Auto-generated method stub
         DefaultMutableTreeNode node = (DefaultMutableTreeNode)
        tree.getLastSelectedPathComponent();
    /* if nothing is selected */
    if (node == null) return;
    System.out.println();
    /* retrieve the node that was selected */
    String nodeInfo = (String) node.getUserObject();
    System.out.println(nodeInfo);
    /* React to the node selection. */
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    String url = "jdbc:oracle:thin:@192.168.0.149:1521:xe";
    String user = "compiere";
    String password = "compiere";
    conn = DriverManager.getConnection(url,user, password);
    Statement stmt = conn.createStatement();
    //String sql="desc '"+nodeInfo+"'";
    String sql=("select column_name,data_type,nullable,data_length from  user_tab_cols where table_name='"+ nodeInfo+"'");
    //System.out.println("23");
    ResultSet rs = stmt.executeQuery(sql);
    ResultSetMetaData md = rs.getMetaData();
       int columns = md.getColumnCount();
        System.out.println(columns);
        for (int i = 1; i <= columns; i++)
            column.addElement( md.getColumnName(i) );
        // System.out.println(column);
         while (rs.next())
            Vector row = new Vector(columns);
            for (int i = 1; i <= columns; i++)
                row.addElement( rs.getObject(i) );
            System.out.println(row);
            data.addElement( row );
              rs.close();
              stmt.close();
    catch(Exception e1)
        System.out.println( e1 );
    default_table=new DefaultTableModel(data,column);
    table.setModel(default_table);
    }

    [Vector.html#clear()|http://java.sun.com/javase/6/docs/api/java/util/Vector.html#clear()]
    private void onSelectAction(TreeSelectionEvent e) {
        data.clear();
    //...

  • "Batch Synchroniz​ation" in Parallel Model

    Hi,
    I'm working on a project with up to 15 UUTs which are supposed to be running using the parallel model, since they have to be able to start and stop separately.
    There are conditions in which all active UUTs are paused and restarted upon request. Communication with the UUTs is established using a single demon. Now I need a synchronization method, to make sure only one thread runs the daemons initialization. Just like a batch synchronization using the "One Thread Only" option.
    The Batch steps do not work in the Parallel Model so is there a best practice establish a synchronization like this? I have some ideas, but I guess I'm thinking too complicated and can't see the wood for trees....
    Cheers
    Oli
    Programming languages don't create bad code, programmers create bad code....

    James,
    thanks for the reply. I guess I can implement sth like you suggested. Was just wondering, if I'm missing some built in option that saves me from tinkering myself.
    Cheers
    Oli
    Programming languages don't create bad code, programmers create bad code....

Maybe you are looking for

  • Image in Header

    Hi All, I'm getting my company logo based on the org id ,and i want to display the same in the header and footer of the out put , how i can acheive this in XML publisher, please help me on this. Thanks & Regs -RG

  • Table/ Report that shows GR and PO

    Are there any tables or reports that give all the GR documents for a PO? and Is there any way to reverse or cancel a GR document?

  • 10.9.4 issues

    I updated from the previous version of Mavericks only to encounter multiple issues.      -Safari will not maintain a stable window. It relaunches three times then fails.      -Finder windows crash/fail. Having read throughout previous posts I tried t

  • Operator query fail silently if multiple srids are in indexed table

    i use an SDO_ANYINTERACT on an indexed table. By error (mine) I inserted data with another srid. All SDO_ANYINTERACT deliver 'FALSE'. May I suggest to raise exception in these cases. I dont like silent failure. I have another suggestion. For pointclo

  • Stack configuration in Cat 3550

    Hi, I have connected two cat 3550 in point-to-point stack connection. I want to know the software configuration part of this. Will there be any master slave mode? how many management IPs will be there for this stack? will all the 48 interfaces will a