How do i implement this while loop

I need to implement this while loop, i tried it using the case structure but i am not able to do it, i am getting a error saying that Missing alignment to tunnel , Case Structure : Unwired selector...
the while loop is :
while ((eps>EPSTol)&(iter<iterMAX))
   Ew = Ew.*(sqrt (F./Fr));         
   Ew (find (isnan (Fr))) = 0;       
   Fr = normalise (Fr);
   eps = chi2 (F, Fr);
end
can you please help me on this....
Attachments:
untitled.jpg ‏1909 KB

It's been said many times before, but it bears repeating;
DO NOT POST BITMAPS TO THE FORUM. DO NOT CHANGE THE EXTENSION OF A FILE TO .jpg, .gif, OR ANYTHING ELSE JUST TO GET IT PAST THE FILTERS.THE FILTERS ARE THERE FOR A REASON.
You will not be able to connect the output of your OR function to the case structure. That would create a circular condition, which you cannot have. Think about it. You want to execute the True case if the output of the Boolean operation is true, but you cannot evaluate the Boolean operation until you have the value generated by the True case. You must have an initial value for eps in order to be able to evaluate the Boolean operation. A shift register (or feedback node) should be used for the eps value, and you can initialize the shift register (or feedback node) to set the initial condition. Example:
It's also worth saying this: To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.
Attachments:
Example_VI_BD.png ‏5 KB

Similar Messages

  • How to out from infinite while loop in sub VI

    Dear Sir,
    how to out from infinite while loop in sub VI from main VI
    attached photo for solution but I can't understand it and i can't find the function in photo 
    please help
    Attachments:
    stop_subVI_frm_main.JPG ‏36 KB

    Asking how to get out of an infinite loop is like asking how to find the end of a circle. I'm not trying to be sarcastic but by definition, if there is a way out of the loop, then it is not infinite. I think what you are asking is how to avoid creating an infinite loop. Is there something about the suggestions you have been given that you do not like? My favorite suggestion is the notifier but maybe you just need an example. Turn on context help and read about the notifier functions in the code below.
    This is your top level VI
    And this is your subVI
    If this seems too complex then a global variable will work too. But what seems simpler can cause much more complex bugs. You can code fast and spend lots of time debugging or you can code slow and spend less time debugging. Personally I perfer writing productive code than looking for bugs any time.
    =====================
    LabVIEW 2012

  • We have a requirement to print the w2 forms for employees using java application, how can i implement this. Please give some suggestion.

    We have a requirement to print the w2 forms for employees using java application, how can i implement this. Please give some suggestion.

    Anyone any ideas to help please?

  • How do I implement this in BI Integrated Planning

    Hi All,
    I need to capture data in the following format I have data of Deliveries Qty by Plant & Material Type in DeliveredQty. The DeliveredQty is the delivqty as of a given date. I need to based on the DeliveredQty calculate the DelivQtyMonth. So if the DelivQty as of today (3rd July) is 1000 EA for 3 days in the current month. The user will provide as input the remaining working days in the month and the number of days in the month elapsed.
    I need to calculate the DelvQtyMonth as follows = DeliveredQty + DeliveredQty/DaysElapsed * DaysRemaining
    The user wants to enter the DaysElapsed and the DaysRemaining in variables.
    Then I need to display the data in the following format:
    Plant    MaterialType          DeliveredQty        DelvQtyMonth         ManualDelvQty
    All data is display only columns except for ManualDelvQty I should provide for user to input data to this column.
    I have created a realtime plan cube with plant materialtype DeliveredQty in it.
    Can you kindly share your inputs how I can implement the DelvQtyMonth based on a variable at run time and ManualDelvQty.
    How can I implement this scenario in BI Integrated Planning.
    So far all I have done is implement a real time cube for capturing the data. I have data for plant materialtype Delivqty for a given fiscal year period. How can I copy this into the plan cube from integrated planning.
    Also, how do I implement the variables for DaysElapsed and DaysRemaining for the user to input values to it.
    Your help is greatly appreciated.
    Thanks
    Karen

    Hi,
    can you look at this
    [http://help.sap.com/saphelp_nw04/helpdata/en/44/584041b02e4c0de10000000a1550b0/frameset.htm]
    Regards,
    muralidhar

  • How can I implement this database?

    Okay, so if you are working with a company who owns more than 10 apartment complexes and they have asked you to build a database.
    So if I want to implement this database.
    What database software package should I use (SQL Enterprise or SQL Data Center) (do not know the difference between the two) or is there any other SQL version that can be used/considered
    Also what else would I have to build or buy? What combination of things do I need?
    What hardware is needed at each apartment complex?
    I was told that something off the shelf will not give me everything I need.

    Please do not duplicate posts. You already posted it here
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5dfc3897-3ffb-490b-8e60-e775b43d3303/how-can-i-implement-this-database?forum=sqlgetstarted
    Andy Tauber
    Data Architect
    The Vancouver Clinic
    Website | LinkedIn
    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click
    "Mark as Answer" and
    "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.

  • How do i exit a while loop using event handler

    Hello,
    I have an event handler structure within which i run a while loop for a particular event. I would like to interrupt the execution of this while loop as soon as another event occurs, even if the while loop has not finished execution. I have tried so many ways, the best i could get is exiting one itteration after the new event occurs which is no good for me.
    Any suggestions???
    Thanks
    Me

    Instead of having a task while loop in an event case, put your task while loop in parallel with the loop surrounding the event structure. When the event which should start the task occurs, you can signal the start of the task while loop. You could use local variables of references to start/stop the loop when an event occurs. You could also use notifiers instead of variables to pass signals to start/stop the while loop. In general you should have a while loop for the event structure, and a parallel while loop to do the tasks. The parallel loop is controlled by variables or notifiers which are set in the event cases.
    - tbob
    Inventor of the WORM Global

  • How to stop execution in while loop without stopping execution of other loops in the same vi

    HI
    I am quite a novice in Labview.
    I have a problem in my project. I used a while loop inside my vi to build an array of ten values along with other loops. Then I used a stop button to stop manually the while loop. But it seems like the loop doesn't stop in the middle of the array building and so other loops in the vi doesn't work until the while loop finishes building the array and as soon as while loop execution is over, the complete vi stops. But all that I wanted was to build the array using the shift register along with the control to stop building array anytime. And not to stop execution of other structures when the while loop finishes.
    Can anyone help me?
    Rahul

    Hi Rahul,
    Modified ur Vi to work with single button.
    But the subtract case is not in any loop.
    So, once both the loops stop, the subtract case will execute only once. Depending on state of subtaract boolean at that time, corresponding case will be executed and the Vi will stop.
    so think of a logic where u can put this also in a new loop.
    Or you can also incorporate it in one of the two loops and pass the other loop's data to it.
    Let us know how you will proceed in this regard
    I am posting your VI as well a VI with my modifications VI in Labview 7.0 so that Thomas can give his suggestions too
    Plus, always keep a time delay in your while loops.
    Oh sorry, the "arrayinouttestnewfinal.vi" is the modified vi
    Regards
    Dev
    Message Edited by devchander on 01-10-2006 06:15 AM
    Message Edited by devchander on 01-10-2006 06:19 AM
    Attachments:
    arrayinouttestnewfinalnew4.vi ‏59 KB
    arrayinouttestnewfinal.vi ‏63 KB

  • How can i get the while loop to enter a different loop beside the first one

    I can't seem to figure out how to change the value to enter into one of the other while statements in the script. I am new to this and can't seem to find anything how to enter in the information to be able to go to different while statements and then run
    what is located in that statement.
    The script is supposed to let me choose between TC, MonsterLock, and Cyc and then jump to the while statement that is associated with one of them and then run what ever is located in that block. All i am getting is a infinite loop and it never sees the other
    while loops. I have 3 set up the go along with the first statement but no matter what i type in for them it always looks at the first while statement and stays there.
    Can someone please help me with having it do what i stated earlier.  
    write-host "This script sets up DATABASE Staging"
    $ProductionDistro = Read-Host -Prompt "Which production do you `enter code here`want to run?(TC/MonsterLock/Cyc)"
    While($ProductionDistro -notmatch "(TC|MonsterLock|Cyc)"){
    write-host "You have entered an error" -ForegroundColor Red
    write-host "You must type TC or MonsterLock or Cyc"
    write-host "you typed $ProductionDistro"
    write-host "This script sets up DATABASE Staging"
    $ProductionDistro = Read-Host -Prompt "Which production do you `enter code here`want to run?(TC/MonsterLock/Cyc)"
    while($ProductionDistro -match $TC) {
    write-host "Sets up location you want to run staging"
    $ElementDistro = Read-Host -Prompt "Which Element do you want to run? (DATABASE1/DATABASE2/DATABASE3/DATABASE4/ALL)"
    While($ElementDistro -notmatch "(DATABASE1|DATABASE2|DATABASE3|DATABASE4|ALL)") {
    write-host "you have enterd an error" -ForegroundColor Red
    write-host "You must type DATABASE1 or DATABASE2 or DATABASE3 or DATABASE4 or ALL"
    write-host "you typed $ElementDistro"
    write-host "set location you want to run staging"
    $ElementDistro = Read-Host -Prompt "Which Element do you want to run? (DATABASE1/DATABASE2/DATABASE3/DATABASE4/ALL)"
    While($PrductionDistro -match $MonsterLock){
    write-host "Sets up location you want to run staging"
    $ElementDistro = Read-Host -Prompt "Which Element do you want to run? (DATABASE1/DATABASE2/DATABASE3/DATABASE4/ALL)"
    While($ElementDistro -notmatch "(DATABASE1|DATABASE2|DATABASE3|DATABASE4|ALL)") {
    write-host "you have enterd an error" -ForegroundColor Red
    write-host "You must type DATABASE1 or DATABASE2 or DATABASE3 or DATABASE4 or ALL"
    write-host "you typed $ElementDistro"
    write-host "set location you want to run staging"
    $ElementDistro = Read-Host -Prompt "Which Element do you want to run? (DATABASE1/DATABASE2/DATABASE3/DATABASE4/ALL)"
    while( $ElementDistro -match $DATABASE1 ){
    function Execute-MySqlcommand {param( [string]$Server, #the host of the SQL server
    [string]$Database1, #the name of the database
    [System.Data.MySqlclient.MySqlcommand]$Command) #the command to execute (name of stored command)
    $mysqlConnection = new-object System.Data.MySqlclient.MySqlConnection
    $MySqlConnection.ConnectionString = "DROP_VIEW DATABASE.BTXADDR;DROP_VIEW DATABASE.BTXSUPB;CREATE_VIEW DATABASE.BTXADDR FOR DATABASE1.DATABASE1S2.BTXADDR;CREATE_VIEW DATABASE.BTXSUPB FOR DATABASE1.DATABASE1S3.BTXSUPB"
    $MySqlConnection.ConnectionString = "TRUNCATE TABLE DATABASE1.DATABASE1S2.BTXADDR;TRUNCATE TABLE DATABASE1.DATABASE1S3.BTXSUPB; INSERT INTO DATABASE1.DATABASE1S3.BTXSUPB SELECT * FROM DATABASE1.DATABASE1S2.BTXSUPB; select count(*) from DATABASE1.DATABASE.BTXADDR; select count(*) from DATABASE1S.DATABASE.BTXADDR; select count(*) from DATABASE1.DATABASE.BTXSURB; select count(*) from DATABASE1S.DATABASE.BTXSUPB;"
    $Command.CommandType = 1 # 1 is the 'Text' command type
    $Command.Connection = $mysqlConnection
    $mysqlConnection.Open()
    $Result = $Command.ExecuteNonQuery()
    $mysqlConnection.Close()
    if ($Result -gt 0) {return $True} else {return $False}
    function Execute-MySQLCommand {param( [string]$Server, #the host name of the SQL server
    [string]$DATABASE1, #the name of the database
    [System.Data.SqlClient.SqlCommand]$Command) #the command to execute (name of stored procedure)
    $sqlConnection = New-Object System.Data.SqlClient.SqlConnection
    $sqlConnection.ConnectionString = "DATABASE_CONNECT_STRING=DSN=DATABASE1;Description=DATABASE1;Trusted_Connection=Yes;WSID=Server;DATABASE=DATABASE1;DATASET=DEFAULT"
    $Command.CommandType = 1 # 1 is the 'Text' command type
    $Command.Connection = $sqlConnection
    $sqlConnection.Open()
    $Result = $Command.ExecuteNonQuery()
    $sqlConnection.Close()
    if ($Result -gt 0) {return $TRUE} else {return $FALSE}
    function Copy-File {
    #.Synopsis
    # Copies all files and folders in $source folder to $destination folder, but with .copy inserted before the extension if the file already exists
    param}($DATABASE0980453.pkg,"d/DATABASE1/code_stg")
    # create destination if it's not there ...
    #mkdir $destination -force -erroraction SilentlyContinue
    foreach($original in ls $source -recurse) {
    $result = $original.FullName.Replace($source,$destination)
    while(test-path $result -type leaf){ $result = [IO.Path]::ChangeExtension($result,"copy$([IO.Path]::GetExtension($result))") }
    if($original.PSIsContainer) {
    # mkdir $result -ErrorAction SilentlyContinue
    # } else {
    copy $original.FullName -destination $result
    cd /d/DATABASE1/code_stg
    install ../DATABASE0980453.pkg
    while($ElementDistro -match $DATABASE2 ) {
    function execute-MySqlcommand {param( [string]$Server, #the host of the SQL server
    [string]$DataBase2, #the name of the database
    [System.Data.MySqlclient.MySqlcommand]$Command) #the command to execute (name of stored command)
    $mysqlConnection = new-object System.Data.MySqlclient.MySqlConnection
    $MySqlConnection.ConnectionString = "DROP_VIEW DATABASE.BTXADDR;DROP_VIEW DATABASE.BTXSUPB;CREATE_VIEW DATABASE.BTXADDR FOR DATABASE2.DATABASE2MS2.BTXADDR;CREATE_VIEW DATABASE.BTXSUPB FOR DATABASE2.DATABASE2S3.BTXSUPB"
    $MySqlConnection.ConnectionString = "TRUNCATE TABLE DATABASE2.DATABASE2S2.BTXADDR;TRUNCATE TABLE DATABASE2.DATABASE2S3.BTXSUPB; INSERT INTO DATABASE2.DATABASE2S3.BTXSUPB SELECT * FROM DATABASE2.DATABASE2S2.BTXSUPB; select count(*) from DATABASE2.DATABASE.BTXADDR; select count(*) from DATABASE2S.DATABASE.BTXADDR; select count(*) from DATABASE2.DATABASE.BTXSURB; select count(*) from DATABASE2S.DATABASE.BTXSUPB;"
    $Command.CommandType = 1 # 1 is the 'Text' command type
    $Command.Connection = $mysqlConnection
    $mysqlConnection.Open()
    $Result = $Command.ExecuteNonQuery()
    $mysqlConnection.Close()
    if ($Result -gt 0) {return $True} else {return $False}
    function Execute-MySQLCommand {param( [string]$Server, #the host name of the SQL server
    [string]$DATABASE2, #the name of the database
    [System.Data.SqlClient.SqlCommand]$Command) #the command to execute (name of stored procedure)
    $sqlConnection = New-Object System.Data.SqlClient.SqlConnection
    $sqlConnection.ConnectionString = "DATABASE_CONNECT_STRING=DSN=DATABASE2; Description=DATABASE2; Trusted_Connection=Yes;WSID=Server;DATABASE=DATABASE2;"
    $Command.CommandType = 1 # 1 is the 'Text' command type
    $Command.Connection = $sqlConnection
    $sqlConnection.Open()
    $Result = $Command.ExecuteNonQuery()
    $sqlConnection.Close()
    if ($Result -gt 0) {return $TRUE} else {return $FALSE}
    function Copy-File {
    #.Synopsis
    # Copies all files and folders in $source folder to $destination folder, but with .copy inserted before the extension if the file already exists
    param}($DATABASE0980453.pkg,"d/DATABASE2/code_stg")
    # create destination if it's not there ...
    #mkdir $destination -force -erroraction SilentlyContinue
    foreach($original in ls $source -recurse) {
    $result = $original.FullName.Replace($source,$destination)
    while(test-path $result -type leaf){ $result = [IO.Path]::ChangeExtension($result,"copy$([IO.Path]::GetExtension($result))") }
    if($original.PSIsContainer) {
    # mkdir $result -ErrorAction SilentlyContinue
    # } else {
    copy $original.FullName -destination $result
    cd /d/DATABASE2/code_stg
    install ../DATABASE0980453.pkg
    While( $ElementDistro -match $DATABASE3 ) {
    function Execute-MySqlcommand {param( [string]$Server, #the host of the SQL server
    [string]$DATABASE3, #the name of the database
    [System.Data.MySqlclient.MySqlcommand]$Command) #the command to execute (name of stored command)
    $mysqlConnection = new-object System.Data.MySqlclient.MySqlConnection
    $MySqlConnection.ConnectionString = "DROP_VIEW DATABASE.BTXADDR;DROP_VIEW DATABASE.BTXSUPB;CREATE_VIEW DATABASE.BTXADDR FOR DATABASE3.DATABASE3S2.BTXADDR;CREATE_VIEW DATABASE.BTXSUPB FOR DATABASE3.DATABASE3S3.BTXSUPB"
    $MySqlConnection.ConnectionString = "TRUNCATE TABLE DATABASE3.DATABASE3S2.BTXADDR;TRUNCATE TABLE DATABASE3.DATABASE3S3.BTXSUPB; INSERT INTO DATABASE3.DATABASE3S3.BTXSUPB SELECT * FROM DATABASE3.DATABASE3S2.BTXSUPB; select count(*) from DATABASE3.DATABASE.BTXADDR; select count(*) from DATABASE3S.DATABASE.BTXADDR; select count(*) from DATABASE3.DATABASE.BTXSURB; select count(*) from DATABASE3S.DATABASE.BTXSUPB;"
    $Command.CommandType = 1 # 1 is the 'Text' command type
    $Command.Connection = $mysqlConnection
    $mysqlConnection.Open()
    $Result = $Command.ExecuteNonQuery()
    $mysqlConnection.Close()
    if ($Result -gt 0) {return $True} else {return $False}
    function Execute-MySQLCommand {param( [string]$Server, #the host name of the SQL server
    [string]$DATABASE3, #the name of the database
    [System.Data.SqlClient.SqlCommand]$Command) #the command to execute (name of stored procedure)
    $sqlConnection = New-Object System.Data.SqlClient.SqlConnection
    $sqlConnection.ConnectionString = "DATABASE_CONNECT_STRING=DSN=DATABASE3;Description=DATABASE3;Trusted_Connection=Yes;WSID=Server;DATABASE=DATABASE3;"
    $Command.CommandType = 1 # 1 is the 'Text' command type
    $Command.Connection = $sqlConnection
    $sqlConnection.Open()
    $Result = $Command.ExecuteNonQuery()
    $sqlConnection.Close()
    if ($Result -gt 0) {return $TRUE} else {return $FALSE}
    cd /d/DATABASE3/code_stg
    install ../DATABASE0980453.pkg
    function Copy-File {
    #.Synopsis
    # Copies all files and folders in $source folder to $destination folder, but with .copy inserted before the extension if the file already exists
    param}($DATABASE0980453.pkg,"d/DATABASE3/code_stg")
    # create destination if it's not there ...
    #mkdir $destination -force -erroraction SilentlyContinue
    foreach($original in ls $source -recurse) {
    $result = $original.FullName.Replace($source,$destination)
    while(test-path $result -type leaf){ $result = [IO.Path]::ChangeExtension($result,"copy$([IO.Path]::GetExtension($result))") }
    if($original.PSIsContainer) {
    # mkdir $result -ErrorAction SilentlyContinue
    # } else {
    copy $original.FullName -destination $result
    While($ElementDistro -match $DATABASE4 ) {
    function Execute-MySqlcommand {param( [string]$Server, #the host of the SQL server
    [string]$DATABASE4, #the name of the database
    [System.Data.MySqlclient.MySqlcommand]$Command) #the command to execute (name of stored command)
    $mysqlConnection = new-object System.Data.MySqlclient.MySqlConnection
    $MySqlConnection.ConnectionString = "DROP_VIEW DATABASE.BTXADDR;DROP_VIEW DATABASE.BTXSUPB;CREATE_VIEW DATABASE.BTXADDR FOR DATABASE4.DATABASE42.BTXADDR;CREATE_VIEW DATABASE.BTXSUPB FOR DATABASE4.DATABASE4S3.BTXSUPB"
    $MySqlConnection.ConnectionString = "TRUNCATE TABLE DATABASE4.DATABASE4S2.BTXADDR;TRUNCATE TABLE DATABASE4.DATABASE4S3.BTXSUPB; INSERT INTO DATABASE4.DATABASE4S3.BTXSUPB SELECT * FROM DATABASE4.DATABASE4S2.BTXSUPB; select count(*) from DATABASE4.DATABASE.BTXADDR; select count(*) from DATABASE4S.DATABASE.BTXADDR; select count(*) from DATABASE4.DATABASE.BTXSURB; select count(*) from DATABASE4S.DATABASE.BTXSUPB;"
    $Command.CommandType = 1 # 1 is the 'Text' command type
    $Command.Connection = $mysqlConnection
    $mysqlConnection.Open()
    $Result = $Command.ExecuteNonQuery()
    $mysqlConnection.Close()
    if ($Result -gt 0) {return $True} else {return $False}
    function Execute-MySQLCommand {param( [string]$Server, #the host name of the SQL server
    [string]$DATABASE4, #the name of the database
    [System.Data.SqlClient.SqlCommand]$Command) #the command to execute (name of stored procedure)
    $sqlConnection = New-Object System.Data.SqlClient.SqlConnection
    $sqlConnection.ConnectionString = "DATABASE_CONNECT_STRING=DSN=DATABASE4;Description=DATABASE4;Trusted_Connection=Yes;WSID=Server;DATABASE=TF90PVS;"
    $Command.CommandType = 1 # 1 is the 'Text' command type
    $Command.Connection = $sqlConnection
    $sqlConnection.Open()
    $Result = $Command.ExecuteNonQuery()
    $sqlConnection.Close()
    if ($Result -gt 0) {return $TRUE} else {return $FALSE}
    function Copy-File {
    #.Synopsis
    # Copies all files and folders in $source folder to $destination folder, but with .copy inserted before the extension if the file already exists
    param}($DATABASE0980453.pkg,,"d/DATABASE4/code_stg")
    # create destination if it's not there ...
    #mkdir $destination -force -erroraction SilentlyContinue
    foreach($original in ls $source -recurse) {
    $result = $original.FullName.Replace($source,$destination)
    while(test-path $result -type leaf){ $result = [IO.Path]::ChangeExtension($result,"copy$([IO.Path]::GetExtension($result))") }
    if($original.PSIsContainer) {
    # mkdir $result -ErrorAction SilentlyContinue
    # } else {
    copy $original.FullName -destination $result
    cd /d/DATABASE4/code_st
    install ../DATABASE0980453.pkg
    While($ElementDistro -match $ALL ){
    function Execute-MySQLCommand {param( [string]$Server, #the host name of the SQL server
    [string]$DATABASE1,$DATABASE2,$DATABASE3,$DATABASE4, #the name of the database
    [System.Data.SqlClient.SqlCommand]$Command) #the command to execute (name of stored procedure)
    $sqlConnection = New-Object System.Data.SqlClient.SqlConnection
    $sqlConnection.ConnectionString = "(DATABASE_CONNECT_STRING=DSN=DATABASE1;Description=DATABASE1;Trusted_Connection=Yes;WSID=Server;DATABASE=DATABASE1;DATASET=DEFAULT;),(DATABASE_CONNECT_STRING=DSN=DATABASE2; Description=DATABASE2; Trusted_Connection=Yes;WSID=Server;DATABASE=DATABASE2;),(DATABASE_CONNECT_STRING=DSN=DATABASE3;Description=DATABASE3;Trusted_Connection=Yes;WSID=Server;DATABASE=DATABASE3;),(DATABASE_CONNECT_STRING=DSN=DATABASE4;Description=DATABASE4;Trusted_Connection=Yes;WSID=Server;DATABASE=TF90PVS;)"
    $Command.CommandType = 1 # 1 is the 'Text' command type
    $Command.Connection = $sqlConnection
    $sqlConnection.Open()
    $Result = $Command.ExecuteNonQuery()
    $sqlConnection.Close()
    if ($Result -gt 0) {return $TRUE} else {return $FALSE}
    install ../DATABASE0980453.pkg
    While($ProductionDistro -match $Cyc) {
    write-host "Sets up location you want to run staging"
    $ElementDistro = Read-Host -Prompt "Which Element do you want to run? (DATABASE1/DATABASE2/DATABASE3/DATABASE4/ALL)"
    While($ElementDistro -notmatch "(DATABASE1|DATABASE2|DATABASE3|DATABASE4|ALL)") {
    write-host "you have enterd an error" -ForgroundColor Red
    write-host "You must type DATABASE1 or DATABASE2 or DATABASE3 or DATABASE4 or ALL"
    write-host "you typed $ElementDistro"
    write-host "set location you want to run staging"
    $ElementDistro = Read-Host -Prompt "Which Element do you want to run? (DATABASE1/DATABASE2/DATABASE3/DATABASE4/ALL)"

    OK, so you've got a reasonable input loop early on:
    write-host "This script sets up DATABASE Staging"
    $ProductionDistro = Read-Host -Prompt "Which production do you `enter code here`want to run?(TC/MonsterLock/Cyc)"
    While($ProductionDistro -notmatch "^(TC|MonsterLock|Cyc)$"){
    write-host "You have entered an error" -ForegroundColor Red
    write-host "You must type TC or MonsterLock or Cyc"
    write-host "you typed $ProductionDistro"
    write-host "This script sets up DATABASE Staging"
    $ProductionDistro = Read-Host -Prompt "Which production do you `enter code here`want to run?(TC/MonsterLock/Cyc)"
    I've only added two things to that code:  a ^ and $ at the beginning and end of your regex pattern.  As originally written, it would have successfully matched any string containing TC, MonsterLock or Cyc (such as "bogusTCwhatever", etc).
    Now, instead of a bunch of extra While loops based on $ProductionDistro, what you need is some conditionals (either a Switch statement, or some If/ElseIf).  For example:
    switch ($ProductionDistro)
    'TC'
    # Do TC Stuff
    break
    'MonsterLock'
    # Do MonsterLock Stuff
    break
    'Cyc'
    # Do Cyc stuff
    break

  • How do i stop a while loop

    I'm new to labview and I'm having a problem stopping a while loop (running windows XP/2000 with the student edition of labview express 7).
    I'm doing a data acquisition program where I'm constantly reading in voltage and comparing it to a set point value, when the input voltage goes above the set point, i want the while loop to stop. How do I do this? I already have an LED going on when the criteria is met, but I'm not sure how to actually stop the loop (i.e. change the iteration value from true to false-i guess). If anyone can please assist me with this I would very much appreciate it.
    I've included my program too.
    Attachments:
    CO_Detection_Monitoring_System_Modified.vi ‏60 KB

    Hello Everyone-
    I've just posted a message about stopping a while loop and it was answered accurately and quickly- thanks to LV_Pro and PauloM- thanks much- its nice too see that there are many helpful people out there! Unfortunately, I have 2 more questions to ask of the forum.
    My application is almost completed- I just need to add an elapsed time counter that will tell me how long it took for my LED to trigger (from my set point-i.e. when from 0:00:00 until when my loop stopped).
    Now I've found a perfect elapsed time counter on the NI web site contributed from Mike Hall from Ohmeda Medical- the page is here.... http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=D37E2493DC333076E034080020E74861&p_node=DZ52032&p_source=external
    So my first question is, it looks like I can just extend the while loop box in my 'CO detector... .vi' and paste just the code from the 'elapsed time.vi' while loop into my loop and I will be set- but do I need to change my wait until next multiple to be a 1000 too in my program? Probably, but I'm not sure hence the question- or other ideas would appreciated.
    My second question is now that my application is complete (after I add the elapsed time above), I need to exactly duplicate this process for 7 other DAQ inputs (i.e. right now I'm using only 1 of 8 analog inputs on the FP-AI110). So should I make my 'CO detector.. .vi' a separate program (I remember reading something about this in one of the posts earlier).
    Any help is very appreciated.
    Thank you again,
    Daniel
    Attachments:
    CO_Detection_Monitoring_System_Modified.vi ‏60 KB

  • How can I make a while loop wait 10 seconds before iterations​?

    I am using labview to for an osmosis system that measures the amout of water lost from the reading on a scale.  
    I currently have the program displaying the data from 3 scales every second.
    I also need to calculate the flux through the membrane over time.
    I do this with a function that takes a change in the scale reading over time (with a shift register) followed by a series of mathematical conversions.
    The readings from the scale display OK every second, but I need to have at least 10 seconds between flux calculations.
    So my question is, how do I make a the shift register take one value from the scale, then wait 10 seconds before taking the second value?  That way I have the mass of water lost over a 10 msecond period.  
    Below is my current while loop for Flux using shift registers from data from 3 scales.  
    Any helkp would be great!
    Also, I'm new at LabVIEW...

    Bob_Schor wrote:
    Do you understand how Dataflow (a key idea behind LabVIEW) works?  If you put a Wait (ms) function (on the Timing Palette) with 10000 (10,000 milliseconds = 10 seconds) inside your While Loop, the principles of Data Flow will require all of the functions inside the While (specifically the Wait function) to finish their execution before the loop can run again.  As everything else in the loop takes approximately 0 seconds, this will make your loop run once every 10 seconds.
    Bob Schor
    I do not think that is a good idea. 
    The inner loop should be in sync with the outer loop, not run independent on it's own timer.
    If the inner loop is running independently you run the risk of using stale data.
    Actually  altenbach is right the inner loop does not need to be a for loop at all, but rather just a case like my suggestion (without the for loop) and the shift registers should be out on the main loop.
    My suggestion was a quick solution going by what little bit of the block diagram I could see, but if the entire code was posted I am sure we would see where more improvements could be made and possibly even a better solution.

  • How do I run two while loops independent of each other?

    I have a simple VI. I have loop 1 with and LED and a stop button and I have loop 2 with an LED and stop button.  They are both in while loops.  When I run the VI,if I stop loop 1, I can not turn it back on.  If I stop loop 2, it will not stop.  I've attached a file with my VI.  
    Attachments:
    2 Loops.vi ‏9 KB

    bebesbabe,
    This looks like a learning exercise, so I will not present a complete solution.
    1. It is not polite to post to the Forum a VI which will not stop except by pressing the Abort button.  The Abort button should only be used to stop a VI if something is wrong with the program during development. Add a stop button to the outer loop.
    2. A loop with no delay will try to run as fast as possible, consuming all the CPU resources it can get. Since these loops are for user interfaces, delays of 100 to 200 ms are appropriate. Use the Wait (ms) function.
    3. Your main problem is understanding dataflow. In LabVIEW any node may execute only when all of its inputs have been given data and it will not complete its execution until all nodes inside it have completed.  Your VI does not have external inputs so waiting for data is not a factor. Each loop is considered a node. So the outer loop will iterate only after BOTH of the inner loops have stopped.  On the next iteration both inner loops will be started again.  Of course if the stop buttons are still pressed, the will stop after one iteration, which will seem almost instantaneous. But because of dataflow as I have described, your program cannot really work the way you want. You cannot restart one loop until both have stopped. Put an indicator on the "i" terminal of the outer loop.
    4. You may wish to consider changing the mechanical action on your stop buttons to Latch when Released.  Read the help to learn about mechanical actions.
    The way the instructions on the front panel read, it is not clear what the intended solution is. What control or user action or program action is required to turn the loops back on? Changing the stop button?  Automatically after a delay? A separate On switch?  How is the entire program supposed to stop?
    Lynn

  • How to validate input using while loop?

    I've written a short program that asks the user to enter their gender. I have a setGender method that checks that the user has entered either M or F before assigning the value to the gender variable. If they haven't, the program continues to ask for their gender until they type M or F. My problem is using the while loop to validate input (pls see below). It works when the user enters the wrong character but it continues to ask for input even after the user enters M or F. How can I fix this loop so that it stops on receiving the correct input and assigns it to the variable?
    cheers
    Chris
    import java.io.*;
    public class TestInput
    private char gender;
    public void checkGender()throws IOException
    System.out.print("Enter your gender: ");
    gender = (char)System.in.read();
    System.in.skip(2);
    setGender(gender);
    System.out.println("Your gender is: " + gender);
    public void setGender(char g)throws IOException
    if (g == 'M' || g == 'F')
    gender = g;
    else
    while (g != 'M' || g != 'F') //Problem area - loop continues after user enters M or F
    System.out.println("Enter M or F for passenger's gender: ");
    gender = (char)System.in.read();
    System.in.skip(2);
    } //end class

    // old code
    while (g != 'M' || g != 'F') // At least one of these comparisons will be true no matter what is given.
    //  what you really meant?
    while (g != 'M'   &&   g != 'F') // keep going while you don't have a valid answer

  • How do I exit a while loop which has a 'read from spreadshee​t' pop up in it?

    I have a while loop which calls 'read from spreadsheet'. My problem is that after entering a filename the loop repeats too quickly for me to hit the end loop button. How do I exit the loop without adding a delay after the read thereby slowing the loop when I don't want to exit. If I select cancel I get 'error 43'. Is there a way to to use an error handler to prevent this from popping up and use it to end the loop?

    It's the error handler inside Read From Spreadsheet that creates the message. Specifically, one of the VIs called is Read Lines From File. The last VI in there is General Error Handler. You can delete it and save it with a different name. You should also modify it to return the error cluster. You'll also want to modify Read From Spreadsheet to return the error cluster so that you can trap the error in your VI. When cancel is selected, error code 43 is generated. Stop the loop when you see 43.

  • Event controll: How to stop a running while loop inside a event structure

    Hello,
    I have some problems with controlling a while loop inside a event structure (see attached VI).
    I habe 3 buttons ("Start Measurement, Stop Measurement, Quit Program"). When a measurement is running, it should be possible to stop the measurement by clicking on "Stop Measurement", but this does not work.
    Has anyone an idea?
    Thanks a lot and best regards,
    Michael
    Message Edited by MichaGue_01 on 04-23-2010 04:37 AM
    Solved!
    Go to Solution.
    Attachments:
    Event_Controll.vi ‏27 KB

    Hello,
    Try not to use while loops inside a Event structure.
    My approach is using two While loops (one will have only the Event structure).
    I had to use to Flag buttons that make it a bit more complicated but i am sure somebody will come up with a better idea, or you might want to have a think about it yourself.
    Have a look on the modified version on the attachment.
    Once you are happy how it works then you can Hide the 2 flag buttons from the Front Pannel by going to Block diagram right-click the indicators and choose option "Hide Indicators/Controls"
    I did it in LV 8.6 so i hope you can open it on your PC if not i can downgrade it.
    If you have any problem let us know.
    Regards
    Dimitrios
    Test Systems Computing Engineer
    Cummins Turbo-Technologies
    Attachments:
    Event_Controll[1]_modified.vi ‏18 KB

  • What's wrong with this while loop?

    Hi, folks. for the code fragment blow, resultSetArray holds two objects of type ResultSet. From those println statement, i can see the whole while loop(the most outter one) process goes alrite the first time right from begining to the end. However, when variable j increases from 0 to 1, the code stops executing at the the line while(rs.next). I just couldnt figure out what causes the problem while i've been fighting with it for several hours. Could someone plz throw me some lights? With your help, i could possibly go to bed before sun rises...
            while(j<resultSetArray.length)
              //for(int j=0; j<resultSetArray.length; j++)
    System.out.println("show me j is called twice " + j);
                   ResultSet rs = resultSetArray[j];
    System.out.println("the converting rs object is called twice and it is not null " + rs);
                  int numWantedColumns = wantedColumnNames.size();
                  //if it's about go or single trip
                  if(j==0 && rs != null)
                      go = new Element("Go");
                       //go.setText("go");
                       //result.addContent(go);
                  //if it's about return trip
                  else if(j==1 && rs != null)
                      back = new Element("Back");
                       //back.setText("back");
                       //result.addContent(back);
                  if(rs!= null)
    System.out.println("this hell is called twice coz it's not null");
                   while(rs.next())
    System.out.println("what about here?");
                        Element flightInfo = new Element("FlightInfo");
         System.out.println("while rs.next() is called");
                        for (int i = 0; i < numWantedColumns; i++)
                           String columnName   = (String)wantedColumnNames.get(i);
         System.out.println("column name is " + columnName);
                           String value = rs.getString(columnName);
          System.out.println("column value is " + value);
                           flightInfo.addContent(new Element(columnName).setText(value));
                        if(j==0)
                           go.addContent(flightInfo);
                        else if(j==1)
                             back.addContent(flightInfo);
                   else if(rs == null)
                        break;
                   j++;
             }

    i've got the problem sort out, eventually. there was actually nothing wrong with the while loop. it was caused by a typo in databse, instead of having Brisbane, i typed Bisbane. The single letter r cost me more than 6 hours to figure it out. it was such a painful feeling while i realized i made a such stupid mistake.
    by the way, as jnw777 mentioned, output rs.next() info instead of the test line. i did try it, however i didnt realize even System.out.println(rs.next()) would cause the cursor move down one row from its current position. so, plus the original while(rs.next()) statement, it was moving the cursor two rows down at a time! And i just couldnt think of this caused me the fact i was only getting the even number row of the ResultSet while i was sniffing the bug from a class with 700+ lines of code. I was so excited and just couldnt stop yelling at the moment i got over it! That was a damn execiting moment...
    now, i am wondering if anyone in this wonderland would like to share his/her stories.

Maybe you are looking for

  • Error While Creating Business Agreement via IC Web CLient

    Dear Experts, I am working on IC Web Client ( CRM 7.0) & ISU (ECC 6). I was able to create the Business Agreement & successfully replicate the same to ISU as a Contract Account. But when I Try to create the Business Agreement from ICWebClient I am ge

  • Purchased movie bundle will not play in itunes but Iwas charged

    I purchased a movie bundle and it shows that it was purchased under iTunes purchased history but it does not display under purchased content in my iTunes library. When I click the bundle again it says that I already own it and ask if i want to repurc

  • Nokia 5233: log shows unwanted GPRS packet connect...

    About two months ago I noticed, on the log, a big number of GPRS - Internet connections that happen at random times. I've seen them in the middle of the night (3:00-4:00 AM) or the day. Example log: Direction: OUT Type: GPRS Duration: 00:01:15 Sent:

  • ITS enable VF03

    Hi, We are trying to enable transaction VF03 to use thru the ITS. We copied the program (sapmv60a) and the transaction to z versions. When starting zvf03 in SAP we get the error message "Selection screen ZSAPMV60A 0101 does not exist". The documentat

  • Firefox does not load web pages; it always says 'can't find server' on every page I try to load

    Firefox 'can not find server' reply comes up on every page I try to load, including my home page. I have to retry or refresh 3-4 times before it takes.