For loop or while loop in process flow

Hi,
Is it possible to use a table as driver for a loop ?
I want to loop (the number of records in my table ) times and use the value of a certain column as parameter in my loop.
Thanks in advance
Carolineb

Carolineb,
I think this is possible - develop three PL/SQL-procedures
1) first procedure PR_GET_LAST_VAL - with one OUT parameter for getting ID of last record from your table (for example select max(id) from your_table)
2) second procedure PR_GET_FIRST_VAL - with one OUT parameter for getting ID of first record
3) third procedure PR_GET_NEXT_VAL - with one IN/OUT parameter for getting ID of next record (for example select min(id) from your_table where id>P_VALUE , where P_VALUE is a procedure parameter)
4) define two variable for process - V_CUURENT (loop variable which will be chaned with third procedure) and V_LAST_VALUE
5) in process flow before LOOP operator insert procedures PR_GET_FIRST_VAL and PR_GET_LAST_VAL and bind parameters to variables V_CUURENT and V_LAST_VALUE respectively
6) define condition for LOOP operator as V_CUURENT <= V_LAST_VALUE
7) in body of LOOP operator insert procedure PR_GET_NEXT_VAL and bind parameter to variable V_CUURENT
Hope my idea is clear.
Regards
Oleg

Similar Messages

  • How do I create a start/stop button for each separate while loop within my program, when each of them does a different task?

    I have a multimeter VI with separate while loops to accomplish the different tasks of reading  voltage, current, etc. Each while loop has a stop button, but I need a button that will have to be pressed in order for the while loop to even start. I tried putting another while loop around the present one, but it still has to run once before it will stop. I want the user to have to press the button before it runs, because they interfere with each other.
    I am just learning so patience and your kind assistance is greatly appreciated!
    ElectroKate

    iZACHdx wrote:
    Hello,
    I'm not entirely clear with everything you have going on and what you want your final functionality to be, but you can use sequence structures to prevent a loop from starting until the user presses a button like this:
    -Zach
    I have to ask, why is an NI employee using examples using sequence frames? The same thing could be accomplished using data flow by simply wiring the value of the first stop button out of teh first while loop and connecting it to the second loop. This would then use data flow to control the sequence. Why show new users bad programming methods?
    As to the original question I would concur with altenbach on using an event structure.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • How to code a parallel 'for loop' and 'while loop' where the while loop cannot terminate until the for loop has finished?? (queues also present)

    I've attached a sample VI that I just cannot figure out how to get working the way that I want.  I've labeled the some sections with black-on-yellow text boxes for clarity during the description that follows in the next few sentences.  Here's what I want:
    1) overall -- i'm intend for this to be a subVI that will do data acquisition and write the data to a file.  I want it to use a producer/consumer approach.  The producer construct is the 'parallel for loop' that runs an exact number of times depending on user input (which will come from the mainVI that is not included).  For now I've wired a 1-D array w/ 2 elements as a test case.  During the producer loop, the data is acquired and put into a queue to be delt with in the consumer loop (for now, i just add a random number to the queue).
    2) the consumer construct is the 'parallel while loop'.  It will dequeue elements and write them to a file.  I want this to keep running continuously and parallel until two conditions are met.
          i. the for loop has finished execution
          ii. the queue is empty.
       when the conditions are met, the while loop will exit, close the queue, and the subVI will finish. (and return stuff to mainVI that i can deal with on my own)
    Here's the problems.
    1)  in the "parallel for loop" I have a flat sequence structure.. I haven't had time to incorporate some data dependency into these two sequential sections, but basically, I just care that the "inner while loop" condition is met before the data is collected and queued.  I think I can do this on my own, but if you have suggestions, I'm interested.
    2)  I can easily get the outer for and while loops to run sequentially, but I want them to run in parallel.  My reasoning for this is that that I anticipate the two tasks taking very different amounts of time. .. basically, I want the while loop to just keep polling the queue to get everything out of it (or I suppose I could somehow use notifiers - suggestions welcome)...  the thing is, this loop will probably run faster than the for loop, so just checking to see that the queue is empty will not work... I need to meet the additional condition that nothing else will be placed in the queue - and this condition is met when the for loop is complete. basically, I just can't figure out how to do this.
    3) for now, I've placed a simple stop button in the 'parallel while loop', but I must be missing something fundamental here, because the stop button is totally unresponsive.  i.e. - when I press it, it stays depressed, and nothing happens.
    suggestions are totally welcome!
    thanks,
    -Z
    Attachments:
    daq01v1.vi ‏59 KB

    I'd actually like to add a little more, since I thought about it a bit and I'm still not quite certain I understand the sequence of events...
    altenbach wrote:
    zskillz wrote:
    So i read a bit more about the 'dequeue element' function, and as I understand it, since there is no timeout wired to the dequeue element function, it will wait forever, thus the race condition I suggested above can never happen!
    Yes, you got it!
    As I've thought about it a bit more, there's a few things that surprise me... first, the reason the 'dequeue element while loop' errors is not because there's nothing in the queue, it's becaues the queue has been released and it's trying to access that released queue...   However the problem I have is this --- Even though there's no timeout wired to the dequeue element, I still would think that the while loop that contains it would continue to run at whatever pace it wanted -- and as i said before.. most of the time, it would find that there is nothing to dequeue, but once in a while, something is there.  however, it seems that this loop only runs when something has been enqueued.  the reason I say this is illustrated in the next code sample MODv2 that's attached below.  I've added a stop button to the "queue size while loop" so the program runs until that is pressed.  I've also added a simple conditional in the "dequeue while loop"  that generates a random number if it a button is pressed... but this button is totally non-responsive... which means to me that the "dequeue while loop" isn't actually continuously running, but only when an element is added to the queue.  this still seems almost like the 'dequeue while loop" waits for a notifier from the queue telling it to run.  can you explain this to me? because it is different from what I expect to be happening.
    rasputin wrote:
    I tried to open your VIs but it doesn't work. LV
    is launched, the dialog box (new, open, configure...) opens and then...
    nothing. Not even an error message. I guess it isn't a problem of LV
    version or a dialog box would appear saying this. Could you, please,
    send a image of the code?
    Thanks,
    Hi Rasputin, I'm using LV8.  I assume that was your problem, but who knows.  I've attached a pic of of altenbach's solution since it's what I needed.
    thanks
    -Z
    Message Edited by zskillz on 10-20-2006 11:49 AM
    Attachments:
    daq01v1MODv2.vi ‏63 KB
    daq01v1MODpic.JPG ‏116 KB

  • Do I use a FOR LOOP or WHILE LOOP for a program like this?

    How do I write a progam in a way that in a certain expression 't+C', the variable t would decrease until the expression t+C will equal a certain expression .99x. Assuming .99x is a constant and C is a constant also. Also I would like to output the maximum value for the variable t (that satisfies the equation t+C=.99X) into a text box.
    Thank You

    Hey Altenbach..maybe I'm being a little vague
    This is for my senior project and I am designing a software package that helps design/simulate the characteristics of a cpacitive pressure sensor.
    If the membrane of the sensor contains a bimetal layer(polymer and metal)...well at some point the thickness 't' of the metal will affect the Young's modulus of the polymer.
    So i have chosen the tolerance of the bimetal in such a way that the combined Young's modulus (of polymer and metal) is at least still 99% of the Young's modulus of the Polymer.
    Now the thcikness t of the metal greatly affects the Young's moudulus of the bimetal...so if a user inputs a really high thickness t for his metal, the program will calculate the combined Young's Modulus and if it is lower than 99% of the Polymer then the program should spit out or suggest the maximum thickness t for which the combined Yung's modulus=99%of polymer.
    So far.
    The combined young's moudulus looks like this
    Yc=(tp/tc)Yp+(tm/tc)Ym.....where tp is polymer thickness and tm is metal thickness, tc is total thickness, Ym is metal Young's modulus and Yp is polymer Young's modulus...
    Now if Yc>.99Yp  and the user inputs a tm to be ridiculously high....then the program should output the maximum value of tm for which Yc=.99Yp. and also pop up an error message saying "your thcikness is too high" or summin like that. I don't know how to write for  or while loops...
    I really hope this helps....thank you very much

  • URGENT:error while deploying a process flow

    EMP_COUNT is a mapping which i have deployed .
    when i try to deploy a process flow i get the following error:
    OMB05602: An unknown Deployment error has occured for Object Type API8028: No signature is available for mapping EMP_COUNT because the generation language is undefined. Please set the generation language property of this mapping, or generate this mapping to set the generation language property to a default value..
    thnx in advance

    OMB+> OMBALTER MAPPING 'EMP_COUNT' SET PROPERTIES (GENERATION_LANGUAGE) VALUES ('PLSQL')
    Fast enough? ;-)
    Regards,
    Detlef

  • OMB05603 while deploying a process flow with OMB

    Hi all,
    I am trying to deploy a process flow with OMB. I tried with the repository owner and with a non-admistrative user, but I am getting the following error.
    OMB05603: Deployment of Component 'PROCESS_FLOW_MODULE' with action 5 is not allowed.
    Any help is appreciated.
    Regards,
    Sebastian
    Code Extract
    catch {
         OMBCREATE TRANSIENT DEPLOYMENT_ACTION_PLAN '$plan_name'
         puts "deployment plan created"
         set objectList [OMBRETRIEVE COLLECTION '$col_name' GET ALL REFERENCES]
         foreach object $objectList {
              set objectType [lindex $object 0]
              set objectName [lindex $object 1]
              OMBALTER DEPLOYMENT_ACTION_PLAN '$plan_name' ADD ACTION '$objectName' \
              SET PROPERTIES (OPERATION) VALUES ('CREATE') SET REFERENCE $objectType '$objectName'
              puts "adding action for object $objectType $objectName"
    }

    Hi Sebastian
    I suspect this is because you are trying to deploy the process flow module.
    The process flow package should be deployed - not the module and not the flow itself.
    Cheers
    David

  • ORA-12154: TNS:could not ... for imported pl-sql function in Process Flow

    Hi
    I included in a process flow a PL-SQL function as user defined transformation.
    This PL-SQL function resides in my source database, from where I imported it in OWB.
    When I am trying the run the Process Flow (from control center manager) I get the following message upon executing that function.
    ORA-12154: TNS:could not resolve the connect identifier specified
    When I don't include that function my process flow works. Mappings in my process flow read from the same source database as where the function is.
    So I don't think it is caused by a problem with tnsnames.ora..
    Thanks in advance for anybodies help.
    Hans

    Hi Oleg,
    Thanks for your reply. Indeed I didn't create a runtime repository.
    However don't like to do that to for the source DB.
    I wonder if I can get around that by executing a SQLplus script instead.
    I tried this but my script does never complete when it is started from the process flow. If I run it in SQLplus it runs fine and completes instantly.
    My script does:
    update 1 column in one record of a table.
    commit;
    exit;
    What do you think?
    Thanks,
    Hans

  • How do I close IMAQ sessions and freeup memory for 3 Camera While Loop continuous Acquire?

    1) I am using an NI PCI-1428 Camera Link frame grabber to interface with a Pulnix TM6710-CL digital camera. I use the latest IMAQ drivers. When I try to work on 3 cameras (as in the NI example program for single HL Grab), it looks like not freeup the memory. Every stop of the application it gives error at IMAQ CLose and the next start also gives error and the third time the application starts ok. Any help!

    Thank you for contacting National Instruments. From your description it does sound like you may be running into problems not closing all of the correct references created in IMAQ Init or you may be creating a large number of buffers you are not removing. From your description it's hard to tell what exactly may be going on from the provided information. Some information that would help us better respond to your problem includes:
    - What error message do you receive?
    - Are you using LabVIEW or a text-based programming language (C, C++, Visual Basic)?
    - What version number of the driver and software are installed?
    - Can you successfully grab and snap images in Measurement & Automation Explorer (MAX)?
    Below I have included a link to a LabVIEW example program
    that acquires from two cameras. I would take a look at this example to see if it provides you with any help:
    Acquisition of Images from Multiple Cameras with Display Options
    http://sine.ni.com/apps/we/niepd_web_display.displ​ay_epd4?p_guid=B45EACE3E44956A4E034080020E74861&p_​node=DZ52489
    Also, the following tutorial discusses some of the issues related to multiple camera acquisitions:
    Multi-Camera Acquisition
    http://zone.ni.com/devzone/conceptd.nsf/webmain/D9​1BAC1317F9D0A686256C9300769A0D?opendocument
    I hope this helps you along with your application and please provide us with some more detail of your error and problem if you are still experiencing any problems.
    Regards,
    Michael
    Applications Engineer
    National Instruments

  • While loop and for loop condition terminal

    Hello friends,
    I am using labview 8.6. The condition terminal of the while loop and conditional for loop is behaving in just the opposite way.
    When i wire a true to the condition terminal of my loop, the while loop continues to run when I click on run. when I wire a FALSE, it stops.
    Is there any setting change that I have to make it to get it work properly.
    Please suggest on this.
    Thanks and regards,
    Herok

    Please do NOT attach .bmp images with the extension changed to .jpg to circumvent the forum filters!
    Herok wrote:
    I am sending you the VI. I am not sure if this would help you because only in 2 computers this behaviour is seen. In others, it works as it is supposed to work.
    Whatever you are seeing must be due to some corruption or folding error. It all works fine here.
    To make sure there are no hidden objects, simply press the cleanup button which would reveal any extra stuff (which is obviously not there). Does it fix itself if you click the termination terminal an even number of times? What if you remove the bad loop and create a new one?
    Could it be you have some problems with the graphics card and the icon of the conditional terminal does not update correctly?
    Whay happens if you connect a control instead of a diagram constant?
    What is different on the computers where it acts incorrectly (different CPU (brand, model), #of cores, etc.) 
    LabVIEW Champion . Do more with less code and in less time .

  • How to run a do-while loop on the 2nd execution after a stop on failure occurs?

    I am trying to use the Stop on Failure process model callback from the TestStand Examples.
    If a step fails within a Do-While loop and the test is terminated, the second time the test is run (continuing to the Next UUT in the process model), the condition for the do-while loop is checked first before it ever enters the loop. This is incorrect because the Do-While loop should execute once and then check the "while" condition.
    Also, If I was to stop the execution altogether and then restart the test (instead of continuing with the Next UUT), it runs the loop once, then checks the "while" condition.
    I'm not sure if I am describing this clearly enough. The execution seems to flow like this:
    Start test
    Do
    NumericTest step FAILS  -> terminate
    Next UUT starts
    While (condition is false and skips over Numeric Test step).
    So it seems that TestStand thinks it's still within that Do-While loop on the second execution and whatever runtime variables are not reset correctly.
    Is this a TestStand bug?  It happens in both TestStand 3.1 and 3.5.
    Is there any way around this?
    Thanks for any help.

    If it is what I think it is, it is a bug. Try unchecking Sequence Properties>>Optimize Non-Reentrant Calls to This Sequence and please tell me if that fixes it.

  • Code golf: stop two while loops with guaranteed iteration ratio

    Proposal
    In the vein of the Perl tradition, I'd like to see if there's any interest in solving short programming puzzles in LabVIEW. Anyone can post a problem and define the rules for solving it.
    Here's a beginning/intermediate question to whet your "palette".
    Description
    With one user-action, how would you stop two while loops such that the ratio of their iterations is the always the same? One concrete way to visualize this situation is in taking measurements: two instruments use the same timing source to take measurements, but second divides the clock down so that it is an integer factor slower than the first. For example, if the slower instrument is four times slower, then at the end of the VI, if the slower instrument takes 100 measurements, the faster instrument has taken 400.
    Rules
    You may only use vi.lib
    You cannot include any other subVIs
    Your solution must pass for loop1 interval as low as 25 ms
    Template (attached in LabVIEW 2009)
    If folks are interested in this, then let's figure out how to make future problems better. Please post your suggestions and critiques, but only if you also post a submission ;-)
    Solved!
    Go to Solution.
    Attachments:
    Multirate Loop Code Golf.vi ‏11 KB

    Norbert_B wrote:
    a) You work with an integer factor of speed. While this matches many application areas, there are still cases where the factor has to be floating point (e.g. 2.5). Additionally, the factor might "invert", so the master loop runs slower than the slave (factor 0.5 for instance).
    It sounds like you're about to post another code golf question. If you think the problem scope is too small, you're welcome to fashion one to your taste. Thanks for volunteering :-D
    Norbert_B wrote:
    b) This example does not take into account that the hardware has to be synchronized with more accuracy than the software supplies (PXI?). If hardware synchronization is required, there are two possible ways:
    - The factor can be included in the synchronization (using PLL for instance)
    - The factor has to be software implemented by data reduction for the task running at the lower pace.
    Hrm, maybe puzzles aren't really your thing after all. You are correct: I did not define every constraint that can lead to a provable best closed-form solution, but that does not prevent people from stating their assumptions and forming creative, well-reasoned, and still correct designs. I overlooked this reading of the description and neglected to add a statement that said solvers were free to add their own conditions. I will do so in the fugure :-)
    If we choose the first of your suggestions, the VI must still retrieve the data at different rates. You can dedicate a loop for each instrument to decouple any jitter and latency introduced by their connectivity or internal operation; this adds some margin of safety when there is thread and driver contention. You can also implement a single counting loop like altenbach and forego the multiloop complexity.
    Norbert_B wrote:
    c) You don't state anything about "what happens with the data". Is this time consuming? Does it introduce additional delay in loop iterations? Is it OK to have data loss?
    I don't know -- you decide, you disclose, and you solve :-)
    In my specific situation, the measurements are time consuming and do add delay (each data "sample" is 5-20 megabytes), none can be lost, and the data must be available for others to analyze later. In addition, the amount of data is saturating the hard disk throughput. If a particular write takes too long, the instrument driver may overwrite a yet unfetched sample, which is unacceptable. I did not add these details to the problem discripton becuase they don't impact the puzzle.
    I don't want to burden people with my situation and ask them to solve my problem: I want to encourage them to bring their intuition and experience to a discussion. This is the design process at its heart: understanding why and how constraints affect your decisions. If a person states the additional conditions they've assumed, readers can learn why, and more importantly, when a Notifier might be more desirable than an Occurance or a Queue more robust than a Data Value Reference.
    The best NI-published advice for stopping multiple while loops (https://www.google.com/search?q=labview+stop+multiple+while+loops) is laughable (and is the "solution" in my template).
    Would you care to re-approach and contribute to this puzzle? I suspect you have a lot to offer :-)

  • Does the inner while loop have to be stopped before the outer loop will run?

    too many while loops cause my controls to be very sluggish.

    Hello,
    The outermost while loop executes everything inside it over and over. Therefore, if you have a while loop inside another while loop, the first iteration of the outer while loop will execute the inner loop, and then the inner while loop will execute over and over again until it is stopped. At this time the outer while loop will perform another iteration, and the process will repeat until the outer loop is stopped. Generally, embedding while loops within while loops is not recommended.
    Please visit the below sites for more information on program efficiency.
    http://zone.ni.com/devzone/conceptd.nsf/webmain/b6605678ad7a09a8862568eb007a6d7a?OpenDocument
    http://zone.ni.com/devzone/learningcenter.nsf/03f7c60f17aad210862567a90054a26c/1b36040af87887078625
    6cbc006fe314?OpenDocument
    I hope this helps!
    --Liz F

  • How to use one single boolean button to control a multiple while loops?

    I've posted the attached file and you will see that it doesn't let me use local variable for stop button, but I need to stop all the action whenever I want but more than one single button on the front panel would look ugly... The file represents the Numeric Mode of
    HP 5371A. thanks for your time
    Attachments:
    NUMERIC.vi ‏580 KB

    In order to use a local variable, you can change the mechanical action of stop button (Switch When Pressed will work), or create a property node for it and select values. You'll also have to do a lot of work changing those for loops into while loops so that you can abort them.

  • While loop problem

    I have a problem with a while loop in this code and it is really holding me up doing my degree. I can see nothing wrong with it but perhaps someone here can help. I would be really greatful if someone could. I have commented the line where the while loop starts about a third of the way down the code.
    Thanks
    Michael
    if (ae.getSource()==client_open)
    int row=0;
    check=true;
    row=client_listing.getSelectedRow();
    try
    System.out.println("information[row][1] is "+information[row][1]);
    if(information[row][1]!=null) //if the index is not null. Comment out this if statement to troubleshoot
    try
    InetAddress inet=InetAddress.getByName(information[row][1]);
    //Create a client socket on the listeners machone on port 7070
    client_socket=new Socket(inet,7070);
    System.out.println("Client port open on 7070 ");
    //Get the output as well as the input streams on that socket
    BufferedOutputStream out=new BufferedOutputStream(client_socket.getOutputStream());
    BufferedInputStream br_socket=new BufferedInputStream(client_socket.getInputStream());
    XMLWriter writer=new XMLWriter();
    writer.requestFString("SHOWFILES"," ");
    String file_data=writer.returnRequest();
    byte file_bytes[]=file_data.getBytes();
    int file_size=file_bytes.length;
    byte b[]=new byte[1024];
    // The methos takes a byte array and it's length as parameters and return
    // a byte array of length 1024 bytes....
    add_on upload=new add_on();
    System.out.println("Class of add_on created sucessfully");
    b=upload.appropriatelength(file_bytes,file_size);
    out.write(b,0,1024);
    /*An output stream is also initialised. This is used to store all the response
    from the listener */
    BufferedOutputStream out_file=new BufferedOutputStream(new FileOutputStream("response.xml"));
    int y=0;
    byte f[]=new byte[32];
    System.out.println("Entering while loop");
    //This while loop is not working. Any ideas. It just hangs here
    while((y=br_socket.read(f,0,32))>0) //the socket input stream is read
    out_file.write(f,0,y); //written on to the file output stream, y bytes from f start @ ofset 0
    out.close();
    br_socket.close();
    out_file.close();
    System.out.println("Exited while loop and closed streams");
    catch(Exception e)
    client_socket=null;
    check=false;
    System.out.println("Didnt enter try");
    try
    client_socket.close();
    catch(Exception e)
    System.out.println("Error occuered "+e.getMessage());
    row=0;
    if(check) //If the exception occurs then do not come here
    Vector parameters=new Vector();
    // A class SParser is also used here this class has a function/method of
    // the name perform which calls the xml parser to parse the xml file
    // generated by the response from the client soket...
    // the function perform returns a Vector which has the files/directories,
    // along with their flag information and size in case of files....
    SParser sp=new SParser();
    System.out.println("SParser object created sucessfully");
    parameters=sp.perform("response.xml");
    System.out.println("Parsing finished ");
    // The vector value returned by the xml parseris then passed as one of
    // the parameters to a class named file_gui this class is responsible for
    // displaying GUI consisting of a table and some buttons along with the
    // root information and flag..
    // Initially since the class is called for the first time the parameter
    // for the root is given the name "ROOT" and the Flag is set to "0"..
    file_gui showfiles=new file_gui(parameters,information[row][1],"Root","0");
    showfiles.show();
    check=false;
    } //end if
    } // end if
    } //end try
    catch(Exception e)
    row=0;
    } //end of ae.getSource()

    Why do you think it hangs at the while loop, eh? You need to put in additional printlns to justify your assertion. It takes alot less time to diagnose if you put in specific try/catch blocks with their own printlns - even if it is not as much fun. When you get into these kinds of troubles, there is no shame in putting in prints at each statement or logical point to track down the actual fault.
    ~Bill

  • Error while deploying process flow

    hi All,
    i am getting below error while deploying 1 process flow.
    Description : Runtime User : OWBPC Started : 2011-06-02 19:18:06.0
    Name Action Status Log
    None Error ORA-00942: table or view does not exist
    None Error RPE-02053: The Oracle Workflow version cannot be retrieved. This may have been caused by an incomplete or incorrect installation of Oracle Workflow or the schema may not contain an Oracle Workflow repository. Please check the location details, reinstall Oracle Workflow, if necessary and try again
    i added only 1 mapping in process flow and mapping containing both tables in taret schema.
    kindly tell me how to fix it.?
    rgds,
    Pc

    hi..thnx for replying..
    i have already installed owf manager from below location in my pc..
    D:\app\pc\product\11.1.0\db_1\owb\wf\install
    and installation was successful..then too I am getting same error while deploying process flow.. im using oracle 11g.. direct me now plz..
    Edited by: PC on Jun 3, 2011 3:48 PM

Maybe you are looking for