How to do comparison in a loop.

Hi all,
  TYPES: BEGIN OF ZROUTE,
         VBELN TYPE VBELN,
         ROUTE TYPE ROUTE,
        END OF ZROUTE.
  DATA : IT_ZROUTE TYPE STANDARD TABLE OF ZROUTE,
         WA_ZROUTE TYPE ZROUTE.
      LOOP AT I_XVTTP_TAB INTO LW_XVTTP.
        WA_ZROUTE-VBELN = LW_XVTTP-VBELN.
        SELECT SINGLE ROUTE
                INTO  WA_ZROUTE-ROUTE
                FROM LIKP
                WHERE VBELN = LW_XVTTP-VBELN
        APPEND WA_ZROUTE TO IT_ZROUTE.
     ENDLOOP.
results from IT_ZROUTE
vbeln    route
1111     A
2222     B
I have some problem in with the code below. I tried to collect vbeln and route into IT_ZROUTE.
However, after i've got the result, i want to do distiguish between the route.
If route A ne route B, then display an error messages.
My problem is, how do i compare the record by looping IT_ZROUTE?  if i set into a temporary variable, the value will always change and i have prb in doing the comparison. eg:
loop it_zroute into wa_route.
   zroute = wa_route-route. "set into a variable
  if zroute = wa_route-route
   "display error message
  endif.
endloop.
Could anyone give me some tips to enhance my code? Really appreciate your help.

Hi SW,
You should never use SELECT statement inside LOOP statement as it will affect performance of the program. Use FOR ALL ENTRIES for the same.
TYPES: BEGIN OF ZROUTE,
VBELN TYPE VBELN,
ROUTE TYPE ROUTE,
END OF ZROUTE.
DATA : IT_ZROUTE TYPE STANDARD TABLE OF ZROUTE,
WA_ZROUTE TYPE ZROUTE.
************Addition STARTS***********
data : I_XVTTP_TAB_temp like I_XVTTP_TAB occurs 0 with header line.
data : begin of likp_itab occurs 0,
            vbeln like likp-vbeln,
             route like likp-route,
          end of likp_itab.
I_XVTTP_TAB_temp[] = I_XVTTP_TAB[].
sort I_XVTTP_TAB_temp by vbeln.
delete adjacent duplicates from I_XVTTP_TAB_temp comparing vebln.
select vbeln
          route
    into table likp_itab
   for all entries in I_XVTTP_TAB_temp
where vbeln eq I_XVTTP_TAB_temp-vbeln.
if sy-subrc eq 0.
sort likp_itab by vbeln.
endif.
************Addition ENDS***************
LOOP AT I_XVTTP_TAB INTO LW_XVTTP.
WA_ZROUTE-VBELN = LW_XVTTP-VBELN.
****************Not required
SELECT SINGLE ROUTE
INTO WA_ZROUTE-ROUTE
FROM LIKP
WHERE VBELN = LW_XVTTP-VBELN
****************Not required
read table likp_itab witj key vbeln = LW_XVTTP-VBELN binary search.
if sy-subrc eq 0.
  WA_ZROUTE-ROUTE = likp_itab-route.
endif.
APPEND WA_ZROUTE TO IT_ZROUTE.
*********Add
clear wa_zroute.
*********Add
ENDLOOP.
Please explain the later part again I am not clear with requirement.
Regards,
Anil Salekar

Similar Messages

  • How do i configure a FOR loop to have the behavior of the step Loop Type: Pass/Fail count?

    Hello,
    I'm using the Pass/Fail count set to one Pass to capture an event generated by my DUT.  I originally used a numerical compare step with the Looping type of Pass/Fail count to accomplish this.  Unfortunately the implementation changed and now I need to execute a few steps that can not be combined within one code module as before. Nor can these steps be put into a subroutine.  One of the steps executes a .NET asembly and I haven't figured out how to pass the reference to the subroutine.  When the subroutine is intered the reference is lost and the methode does not execute correctly.
    I have an evaluation function the exits the loop when the expected conditions are met. Everything works except for the Overall Pass/Fail result of the For loop.  If the loop exits due to the first numerical compare test passing, I want the loop overall execution to report as "Passed".  If the loop reaches it's predetermined number of iterations, the overall result needs to report as "Failed".  It would also be nice to have the radio button functionality of "Record Result of Each iteration".  Some conditions require a wait over a minute for the event to occur and I don't want to generate needless data for the report.
    Currently I get the pass/fail status for each For loop iteration, but only "Done" for each loop iteration.  I don't want the initial few failures to cause the test to fail.
    Does anyone know how to do this? Suggestions?
    Thanks,

    I have 2 steps in the loop that can not be combined into one step. This forces me to implement the behavior in some form of loop.  A While Loop could be an option.  I would need to pass the Step.Result.Status from the Multiple Numerical compaire step to the condition of the While Loop.  I tried to use the Step.TS.ID without success.  Some form of reference to the numerical compare step would be needed. I'm using a For Loop as I do want to limit the number of iterations of the loop.  In the case where the loop iterations are reached, the event I am trying to detect did not occur at the correct time and a failure needs to be reported.
    I came up with something based on my comments in the second post:
    1) To start with I configured a Locals.ForLoop_5 variable.  This is used to set the limit on the loop iterations and for comparison after the loop has finished executing. More on that later.
    2) The first step inside the loop invokes a method within a .NET assembly that has been packed in a DLL This method gets the required data from the DUT and stores it to a text file.
    3) The next step is the Multiple Numeric Limit step.  This step invokes a VI that extracts the data from the text file.  This step has been customized in several ways.
      i)  In Run Options, the Results Recording Option was disabled.  This prevents recording of "Failed" while the loop executes when waiting for the event to happen.
      ii) In Run Options, the Step Failure Causes Sequence Failure is unchecked.  Same reasoning as i)  These steps are not true failures.
      iii) A Post Action is configured to go to the nexxt step after the For Loop End step On Condition True with the logic of Step.Result.Status == "Passed".  This causes the loop to exit when the first "Passed" is encountered which corrolates with the event I'm trying to detect. On Conditon Fail remains set to default.
    4)  The step after the For Loop End is an expression step with everythin set to default except for the Status Expression logic set to: Locals.Loopindex < Locals.ForLoop_5 ? (Step.Result.Status = "Passed") : (Step.Result.Status = "Failed"). This step performs the overall Pass/Fail reporting for the For Loop.  If the number of loop iterations is less than the maximum it could have only gotten there by the previous logic triggered by the numerical compare passing, therefore "Passed".  If the loop index has reached the limit, then the event was not detected, therefore Failed.
    I have tested this work around with success, it just a pain to now have to implement this on my 40 some odd For Loops.
    If there is a better way, I'd still like to hear it.

  • How can I repeat a for loop, once it's terms has been fulfilled???

    Well.. I've posted 2 different exceptions about this game today, but I managed to fix them all by myself, but now I'm facing another problem, which is NOT an error, but just a regular question.. HOW CAN I REPEAT A FOR LOOP ONCE IT HAS FULFILLED IT'S TERMS OF RUNNING?!
    I've been trying many different things, AND, the 'continue' statement too, and I honestly think that what it takes IS a continue statement, BUT I don't know how to use it so that it does what I want it too.. -.-'
    Anyway.. Enought chit-chat. I have a nice functional game running that maximum allows 3 apples in the air in the same time.. But now my question is: How can I make it create 3 more appels once the 3 first onces has either been catched or fallen out the screen..?
    Here's my COMPLETE sourcecode, so if you know just a little bit of Java you should be able to figure it out, and hopefully you'll be able to tell me what to do now, to make it repeat my for loop:
    Main.java:
    import java.applet.*;
    import java.awt.*;
    @SuppressWarnings("serial")
    public class Main extends Applet implements Runnable
         private Image buffering_image;
         private Graphics buffering_graphics;
         private int max_apples = 3;
         private int score = 0;
         private GameObject player;
         private GameObject[] apple = new GameObject[max_apples];
         private boolean move_left = false;
         private boolean move_right = false;
        public void init()
            load_content();
            setBackground(Color.BLACK);
         public void run()
              while(true)
                   if(move_left)
                        player.player_x -= player.movement_speed;
                   else if(move_right)
                        player.player_x += player.movement_speed;
                   for(int i = 0; i < max_apples; i++)
                       apple.apple_y += apple[i].falling_speed;
                   repaint();
                   prevent();
                   collision();
              try
              Thread.sleep(20);
              catch(InterruptedException ie)
              System.out.println(ie);
         private void prevent()
              if(player.player_x <= 0)
              player.player_x = 0;     
              else if(player.player_x >= 925)
              player.player_x = 925;     
         private void load_content()
         MediaTracker media = new MediaTracker(this);
         player = new GameObject(getImage(getCodeBase(), "Sprites/player.gif"));
         media.addImage(player.sprite, 0);
         for(int i = 0; i < max_apples; i++)
         apple[i] = new GameObject(getImage(getCodeBase(), "Sprites/apple.jpg"));
         try
         media.waitForAll();     
         catch(Exception e)
              System.out.println(e);
         public boolean collision()
              for(int i = 0; i < max_apples; i++)
              Rectangle apple_rect = new Rectangle(apple[i].apple_x, apple[i].apple_y,
    apple[i].sprite.getWidth(this),
    apple[i].sprite.getHeight(this));
              Rectangle player_rect = new Rectangle(player.player_x, player.player_y,
    player.sprite.getWidth(this),
    player.sprite.getHeight(this));
              if(apple_rect.intersects(player_rect))
                   if(apple[i].alive)
                   score++;
                   apple[i].alive = false;
                   if(!apple[i].alive)
                   apple[i].alive = false;     
         return true;
    public void update(Graphics g)
    if(buffering_image == null)
    buffering_image = createImage(getSize().width, getSize().height);
    buffering_graphics = buffering_image.getGraphics();
    buffering_graphics.setColor(getBackground());
    buffering_graphics.fillRect(0, 0, getSize().width, getSize().height);
    buffering_graphics.setColor(getForeground());
    paint(buffering_graphics);
    g.drawImage(buffering_image, 0, 0, this);
    public boolean keyDown(Event e, int i)
         i = e.key;
    if(i == 1006)
    move_left = true;
    else if(i == 1007)
         move_right = true;
              return true;     
    public boolean keyUp(Event e, int i)
         i = e.key;
    if(i == 1006)
    move_left = false;
    else if(i == 1007)
         move_right = false;
    return true;
    public void paint(Graphics g)
    g.drawImage(player.sprite, player.player_x, player.player_y, this);
    for(int i = 0; i < max_apples; i++)
         if(apple[i].alive)
              g.drawImage(apple[i].sprite, apple[i].apple_x, apple[i].apple_y, this);
    g.setColor(Color.RED);
    g.drawString("Score: " + score, 425, 100);
    public void start()
    Thread thread = new Thread(this);
    thread.start();
    @SuppressWarnings("deprecation")
         public void stop()
         Thread thread = new Thread(this);
    thread.stop();
    GameObject.java:import java.awt.*;
    import java.util.*;
    public class GameObject
    public Image sprite;
    public Random random = new Random();
    public int player_x;
    public int player_y;
    public int movement_speed = 15;
    public int falling_speed;
    public int apple_x;
    public int apple_y;
    public boolean alive;
    public GameObject(Image loaded_image)
         player_x = 425;
         player_y = 725;
         sprite = loaded_image;
         falling_speed = random.nextInt(10) + 1;
         apple_x = random.nextInt(920) + 1;
         apple_y = random.nextInt(100) + 1;
         alive = true;
    And now all I need is you to answer my question! =)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    package forums;
    import java.util.Random;
    import javax.swing.Timer;
    import javax.imageio.ImageIO;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class VimsiesRetardedAppleGamePanel extends JPanel implements KeyListener
      private static final long serialVersionUID = 1L;
      private static final int WIDTH = 800;
      private static final int HEIGHT = 600;
      private static final int MAX_APPLES = 3;
      private static final Random RANDOM = new Random();
      private int score = 0;
      private Player player;
      private Apple[] apples = new Apple[MAX_APPLES];
      private boolean moveLeft = false;
      private boolean moveRight = false;
      abstract class Sprite
        public final Image image;
        public int x;
        public int y;
        public boolean isAlive = true;
        public Sprite(String imageFilename, int x, int y) {
          try {
            this.image = ImageIO.read(new File(imageFilename));
          } catch (IOException e) {
            e.printStackTrace();
            throw new RuntimeException("Bailing out: Can't load images!");
          this.x = x;
          this.y = y;
          this.isAlive = true;
        public Rectangle getRectangle() {
          return new Rectangle(x, y, image.getWidth(null), image.getHeight(null));
      class Player extends Sprite
        public static final int SPEED = 15;
        public Player() {
          super("C:/Java/home/src/images/player.jpg", WIDTH/2, 0);
          y = HEIGHT-image.getHeight(null)-30;
      class Apple extends Sprite
        public int fallingSpeed;
        public Apple() {
          super("C:/Java/home/src/images/apple.jpg", 0, 0);
          reset();
        public void reset() {
          this.x = RANDOM.nextInt(WIDTH-image.getWidth(null));
          this.y = RANDOM.nextInt(300);
          this.fallingSpeed = RANDOM.nextInt(8) + 3;
          this.isAlive = true;
      private final Timer timer = new Timer(200,
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            repaint();
      public VimsiesRetardedAppleGamePanel() {
        this.player = new Player();
        for(int i=0; i<MAX_APPLES; i++) {
          apples[i] = new Apple();
        setBackground(Color.BLACK);
        setFocusable(true); // required to generate key listener events.
        addKeyListener(this);
        timer.setInitialDelay(1000);
        timer.start();
      public void keyPressed(KeyEvent e)  {
        if (e.getKeyCode() == e.VK_LEFT) {
          moveLeft = true;
          moveRight = false;
        } else if (e.getKeyCode() == e.VK_RIGHT) {
          moveRight = true;
          moveLeft = false;
      public void keyReleased(KeyEvent e) {
        moveRight = false;
        moveLeft = false;
      public void keyTyped(KeyEvent e) {
        // do nothing
      public void paintComponent(Graphics g) {
        super.paintComponent(g);
        //System.err.println("DEBUG: moveLeft="+moveLeft+", moveRight="+moveRight);
        if ( moveLeft ) {
          player.x -= player.SPEED;
          if (player.x < 0) {
            player.x = 0;
        } else if ( moveRight ) {
          player.x += player.SPEED;
          if (player.x > getWidth()) {
            player.x = getWidth();
        //System.err.println("DEBUG: player.x="+player.x);
        Rectangle playerRect = player.getRectangle();
        for ( Apple apple : apples ) {
          apple.y += apple.fallingSpeed;
          Rectangle appleRect = apple.getRectangle();
          if ( appleRect.intersects(playerRect) ) {
            if ( apple.isAlive ) {
              score++;
              apple.isAlive = false;
        g.drawImage(player.image, player.x, player.y, this);
        for( Apple apple : apples ) {
          if ( apple.isAlive ) {
            g.drawImage(apple.image, apple.x, apple.y, this);
        g.setColor(Color.RED);
        g.drawString("Score: " + score, WIDTH/2-30, 10);
      private static void createAndShowGUI() {
        JFrame frame = new JFrame("Vimsies Retarded Apple Game");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(new VimsiesRetardedAppleGamePanel());
        frame.pack();
        frame.setSize(WIDTH, HEIGHT);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      public static void main(String[] args) {
        SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              createAndShowGUI();
    }Hey Vimsie, try resetting a dead apple and see what happens.

  • Working in Logic 9, how do I use a drum loop WITH ITS PRESET EFFECTS? I can drag and drop the loop but it plays dry in timeline. thanks

    Working in Logic 9, how do I use a drum loop WITH ITS PRESET EFFECTS? I can drag and drop the loop but it plays dry in timeline. thanks

    Here's the short-cut solution:
    Green Apple tracks are MIDI files (so to speak). If you drag one from the loop browser (Capitol C Orchestral hit, as you mentioned in this exable) directly into the arrange page it creates the MIDI file and the instrument to play it back on.
    HOWEVER.If you create and audio track first, THEN drag the green Apple loop onto that track, the loop will get "bounced" with the reverb in tact and you'll have the exact sound that you heard in the preview.
    Make sense?

  • How can I get my ES2 loops to play correctly? I keep getting the message that the audio is not found when I drag the loops from my audio browser even though they play fine in the preview.

    How can I get my ES2 loops to play correctly? I keep getting the message that the audio is not found when I drag the loops from my audio browser even though they play fine in the preview.

    It's exactly as I stated. Whenever I try to drag these kinds of loops (ESX24 / software instrument loops? the ones marked in green with the white music note next to them) from the loop browser into the timeline a message comes up saying Audio Not Found for that loop.  And a new track is created automatically when loops are dragged into the timeline, so I'm not creating some other random / synth instrument track so I'm not sure  what the deal is... But perhaps I'll try creating a software instrument track first and then drag the loop into that track and see what happens - maybe there's something with the default settings that automatically creates audio tracks whenever loops are imported?

  • 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

  • How do I stop mail from looping the same emails into inbox?

    How do I stop mail from looping the same emails into the inbox over and over again? It does the same thing with deleted messages that keep showing up again and again in multiples even after deleting them. I have made sure my server settings in all email accounts are set to delete immediately once I delete them on my MacBook Pro/IPhone. This issue has severely compromised the efficiency of Mail on my MacBook. Thanks for any help you're able to give me.

    I have tried that but it does not fix the problem.
    The "card" group is not a previous recipient.
    Although not available for editing in Contacts, it is a valid group showing up in the "To" field of Messages, Mail, or any app using the AddressBook.
    Its associated file is automatically created in:
    ~/Library/ApplicationSupport/AddressBook/Sources/<hexaFolder>/MetaData/<hexa>ABG roup.abcdg
    This is why it also shows up in the Spotlight results...
    If I manually remove this file, it gets recreated...
    If I turn off the syncing through iCloud, the entry gets deleted. If I turn it up, it comes back!

  • How to get out of for loop in eclipse debugging

    How to get out of for loop in eclipse debugging for java classes ?
    I am in a for loop in a code. i want to get out of it ...but how ?

    is changing the behaviour of a running class like that really going to be any use for debugging? what's the actual problem?

  • How to insert delay without using loops, and how can I use variable to store data in labview

    Hi all,
    I am new to Labview and I realized that quite often I am in condition to require a delay beween two functions or elements.. how can we insert a delay in such cases?
    I know how to use delays in a loop. but don't know how to inser some time delay between two elements.
    I have one more question, I know its a bad practice to post 2 questions in 1 thread.
    How can I use a temporary variable to store data, So far I am storing it in an indicator by making it invisible in front panel and making local variable of that indicator, is it the right way to do it ?
    Thanks in advance.

    Generally, LV doesn't have variables in the same sense that most languages do. You can use indicators to perform the same function as variables, but as Adnan pointed out, you run the risk of having race condition and it creates data copies, which is a problem if you have a lot of data. In most cases, you should use wires to perform the function of variables, which is to store data and make it available to the different functions in your code. Instead of thinking about variables, you need to think about data (something like "I have the data coming out of this function. Where does it need to go?").
    Try to take over the world!

  • How to make comparison between strings using Labview

    helo, i want to know, how to make comparison between array of string.?
    the transmitter have send the assign text such as
    A hello            Bhye  Cbye

    Hi Syanitaa,
    You actually only need to post the question once. 
    Multiple duplication. Please refer to this thread.

  • How do I stop an infinite loop because of a poorly placed user prompt during developmen​t without closing LabView?

    How do I stop an infinite loop because of a poorly placed user prompt during development without closing LabView?
    Thank you!
    Solved!
    Go to Solution.

    chuck72352 wrote:
    Here is an example of a VI that I can't stop.
    Epic Fail
    but seriously, as was suggested, download Darren's Abort.vi. It comes in very handy for these.
    Message Edited by Broken Arrow on 05-03-2010 01:06 PM
    Richard

  • How do i clear a restore loop on ipod 5?

    how do i clear a restore loop on ipod 5?

    Loop
    Maybe:
    Restore loop (being prompted to restore again after a restore successfully completes)
    Troubleshoot your USB connection. If the issue persists, out-of-date or incorrectly configured third-party security software may be causing this issue. Please follow Troubleshooting security software issues. .
    Next try placing in DFU mode and then restoring.
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    Then try restoring on another computer.
    Last, make an appointment at the Genius Bar of an Apple store.
    Apple Retail Store - Genius Bar

  • Does anybody have an idea how to pre-tune an apple loop that is slightly off pitch?

    Aloha,
    Does anybody have an idea how to pre-tune an apple loop that is slightly off pitch?
    I have a great 44.1K minor key shamisen phrase sample that is 66 cents below C. I want to make it an apple loop and assign it's key to C minor. How would you suggest I do this so that when I use the subsequent apple loop it is in tune?
    Thanks in advance,
    Tony

    Wow . . . seems strange that there are no responses. There are a lot of nice off-pitch samples out there and it would be great not to have to adjust them every time.
    I did come up with a work around. Most of my sample editors introduce artifacts when I change the pitch so here's what I did. Using Sound Studio (great, btw) I made a loop and changed the pitch non-destructively. In this case my sample, played at -66 cents, became tuned to C. Noting that value, I used an internet cents to frequency converter (http://www.sengpielaudio.com/calculator-centsratio.htm) to come with the number to multiply with my original sample frequency. I changed my sample to this frequency (without resampling) then resampled it back to its original 48K. Now I was able to convert it to an apple loop perfectly tuned to C.
    Cheers!

  • Beginner wants to know how you can on the first loop enter a value then let a feedback number take over from there

    How can I on the first loop enter a number into the amplitude subsection of the simulated signal box, and then from that loop onwards use the feedback number?
    I am using a simulated signal, tone measurements, and case structure with + or - calculations depending on orignal reading to control the amplitude to a user defined value.
    Any help would be very much appreciated, as i have just started out on labview 7
    Cheers

    That's the purpose of a shift register or feedback node. They are the same thing and interchangeable. Loop at the attached picture. You initialize either outside the while loop and then whatever calculations you perform, are passed to the next iteration.
    Attachments:
    feedback with initialization.jpg ‏8 KB

  • 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

Maybe you are looking for

  • Can no longer see photos from my library

    I wanted to point iPhoto to a different (older) library and this is what I did: I renamed the "iPhoto library" folder to "iPhoto library_new" (because these are newer pictures) and then I moved the older library folder into "Pictures" and renamed it

  • Volume is muted when Mac Mini starts up.

    Hi all, I currently use my previous generation Mac Mini (Core 2 Duo 2.0) in my media center. Whenever I restart the machine, the volume is muted when it starts back up.. I then have to go in and manually unmute it. Because this is part of the enterta

  • Ipod says no Wi-fi

    why wont my 8gb ipod touch connect to Wi-Fi. I also have a 16GB which will connect to Wi-Fi. I have tried everythig possible to connect and have not had any luck

  • PO document flow table

    Hi All, Can u please tell me which table is used to see PO document flow? Thanks & Regards Santhosh

  • How to insert Generation Date?

    I have RoboHelp for Word 7.0 When I "Generate PrimaryLayout", I would like the current date to be inserted into a particular field in one of the topics. How do I achieve that?