Flexible state machine "configuration" (script interpreter?)

Hi all,
I am currently re-thinking the implementation of a larger labview project which controls
an instrument via RT on a CRIO system.
Since the instrument is constantly improved and new features added to make it more and more
automated I come to the limits of the current design.
A quick description:
The instrument should be capable of taking different kinds of measurements either at
constant conditions or at conditions that continuously change.
Before an measurement, the instruments needs to be conditioned, which is a rather complicated
sequence of valves opened/closed, pumps started/stopped, temperature settings and so on.
I currently use commands stored in a text file and read into an array of command clusters (enum'ed command + string for parameters)
to be processed during conditioning.
Then the user can run another sequence to make a certain kind of measurement.
This works nicely but is not flexible enough. The conditioning and measurement sequences should be easily 
editable without making changes to LV code.
This is one reason I did not yet code this as a state machine, but it is a logical next step to do so.
States would be idle, conditioning, measurement, re-conditioning ....
But how do I do this in a most flexible way?
In the sequences, I sometimes need to check for instrument parameters, and it would be elegant to
call sub-sequences. I already implemented a looping feature to repeat some commands
between two positions in the command array several times. But without the possibility to jump
out of the loop.
In short, if I continue this way I am about to write an interpreter for a simple scripting language .....
I know that possibly VeriStand has a lot of this functionality but I am bit hesitant to make
a big change like this and I am not sure if I can re-use the existing LV code to access and control
hardware using VeriStand.
Is there a good/elegant solution to what I intend to do with just LV and without re-inventing the wheel (script interpreter)?
Olaf

The most flexible way to implement this would be to use a command pattern and LabVIEW classes.  Using this approach, you core state machine would probably never change and you dynamically add or remove steps as needed.  Take some time to learn how this works by writing a couple of simple examples, then dive in.  It will be easier than you may think.
This account is no longer active. Contact ShadesOfGray for current posts and information.

Similar Messages

  • Ini state machine

    Anybody has an example of a state machine that uses a ini file to get test sequence?
    Yik
    Kudos and Accepted as Solution are welcome!

    Hm, i wouldn't use a state machine in order to load "sequencing instructions" from an ini file and use those to control the state machine from now on.
    I would rather recommend a Queued Message Handler since it is more flexible in "static order of execution which might eventually change".
    On a second thought, i would not use an ini file at all but a simple spreadsheet file.....
    I use ini files for configuration settings mainly (default values), which can include localization of the UI of appliciations as well.....
    hope this helps,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • How to use a event structure with a state machine

    First, I would like to inform you that I only work on LabView part time, and have much to learn.  Anything I do learn, I usually forget until I need it again, because I only work on it part time.
    Using your StopWhileLoopMOD[1].vi, I am trying to put a state machine inside the event structure.  
    Related link: http://forums.ni.com/t5/LabVIEW/How-to-stop-while-loop-in-Event-case/td-p/465564/page/2
    Here is my application:  on the front panel, the user can select any combination of 7 different tests.  I have created cases to perform each step of each test in the correct order, but if the user presses stop, the tests won't stop because some of the cases have a while loop inside the event structure (like you mentioned is a bad idea).  The user should be able to stop the test, reselect tests to perform, and re-start the tests. 
    When the start button is pressed for the event structure, I need all the cases to run in the proper order, unless stop is pressed.
    In the past I have indexed an array and used that to run the state machine, but it won't stop immediately.  
    I have sub VIs that are built in while loops because the outputs of the product needs time to stabilize.  The state machine stops and waits up to a certain number of iterations.  If it passes the test, the while loop stops and the next state starts.  If it takes too long, it exits and reports an error.  Maybe I need to just use the state machine and not an event structure?
    Is there a good example of an event structure?
    metzler CLAD
    Solved!
    Go to Solution.

    I'm not sure exactly what you are asking, but it sounds like you want to script a bunch of tests and if the user says stop, to immediately stop the current test and abandon the others?  I'm going to assume that you know how to clear the array so that it will abandon the others, so I'm guessing that you are having trouble abandoning the current test?  If this is indeed the case, then the problem is that you are not able to propagate the message from the main VI FP which is the GUI to the sub vi which is the test, where the test may or may not have a GUI (FP visible) of it's own.  Threading was the first thing to come to mind, but this may not be necessary using events.
    You can do this by passing a refnum of the stop button to the subVI, where you can then add that wait to the event case structure.
    I've attached 2 VIs, mainvi.vi which is just a loop displays the count*2 (number of seconds passed since running) that will call subvi.vi and then check to see if the stop button is pressed.  mainvi.vi is by no means a state engine, it is just a simple loop for demonstration purposes.  subvi.vi just waits 2 seconds and leaves, it is a better structured state engine with an init state to start a poll case to wait for events and an exit state to clean up.  You can modify this any way you wish to get it to do what you want.  You will note that even if subvi.vi is being executed, it will terminate immediately when the stop button is pressed.
    Hope this helps.
    A
    Attachments:
    mainvi.vi ‏17 KB
    subvi.vi ‏33 KB

  • Producer consumer vs state machine

    Hi there,
    I have been on and around for quite a while to understand how can I re-design an application, which was originally built using a mix of sequence structure, while loops and event structures. And now I am making a newer version of the same application, for research purposes, while learning the LabVIEW techniques. Earlier I used LabVIEW versions 5 and 6 to make simple programs for fuzzy logic and neural networks. And that's not a good reference.
    Ok, after learning that Producer Consumer (PC) and Standard State Machines (SSM or SM) are two new approaches for a better (scalable, flexible and efficient) coding as suggest by veterans, in one thread where I asked about another issue, I have started digging into this topic and now I am on a point where I have to implement it finally (spent pretty much time in the learning phase).
    I have several questions.
    To start the discussion, I would give a brief description of my application.
    It's a networked application, where the network communication happens using DataSocket (one reason to use LabVIEW as the environment).
    We are talking about the client application, which communicates with other applications on remote computer, via Internet.
    User interface involves a tab control, with several pages-
    On startup, the controls/indicators (now onwards referred as controls only), are initialized, datasocket connection is checked (rather internet is checked, and a connection established with the remote datasocket server) (page 1)
    If connected to the datasocket server, the user selects Login/Registration (page 2)
    Login and/or Registration happen on page 3/4
    Then the user sees a table of remote users to connect to (page 5)
    Upon selection of a remote user, and after clicking on "connect", the user will see a video indicator, with a lot of other controls. (page 6)
    On this page with video indicator and controls, the user has a lot of activities, in which many messages are sent and received to/from the remote machine.
    the user may disconnect and go back to page 5, and log out and go back to page 2 and so on.
    I hope this is clear.
    I have thought about two different ways to do this application. Using PS or by SSM.
    In the attachments, I have given a diagram (with errors, of course, because of unlinked controls), for each of the approach, plus the original application's diagram.
    I hope this is sufficient for anybody to understand my case and give suggestions.
    I am looking for suggestions about which is a better model for my type of case. I have been to discussions like this one and saw that there are many issues regarding dequeue in PC model. So I am curious to know if SSM is a better and latest model or it's more primitive? Which looks better for my application's performance?
    Thanks ahead!
    Vaibhav
    Attachments:
    OldDesign.vi ‏41 KB
    PCDesign.vi ‏42 KB
    SSMDesign.vi ‏46 KB

    Vaibhav wrote:
    @ Harold
    Thanks. Any suggestion how can I start and stop that loop in parallel with other loops? Like, if some event occurs, the loop should start execution, and keep on moving, while other events are being traced and executed.
    In those examples where you had a while loop inside a case structure, that bit of code will only execute one time.  It will immediately read the boolean at the start of the program, if the value was true before the porgram started, then the while loop will run.  Once that while loop stops, the case structure will end.  It will never execute again unless you completely stop and restart your program.  If the boolean is false before the program starts, the false case will execute immediately.  Nothing happens since it is empty and it is done, never to run again (unless you stop and restart your VI)  You should turn the structure around.  Put the case structure in the while loop.  Make sure you put a small wait statement in the loop so that it doesn't run full speed eating up CPU cycles just polling the status of the boolean.
    @ Ravens
    Thanks for the detailed comment.
    One thing I would clarify. The user will not be able to switch between the pages using the tab control. The program will direct appropriate page to the user. I kept the tabs visible just for your idea of the pages. Sorry, I didn't mention that.
    Do you think it's still a bad design?
    If the tabs will be hidden or disabled, you will probably be okay.  I wouldn't call it a bad design.  I wouldn't do it that way.  But as long as you understand the possibility of problems and prevent that.  Especially some time down the road when you modify the program in some other way that could lead to a problem because you forgot about the dependencies of the event structures on the state of the state machine. 
    Yes, I agree about only one event structure to handle all the events. But since the user will not be able to click somewhere else, other than those possible controls, I thought to keep it like this.
    I thought the events are captured only if we are in that case. I think I am wrong, right? Events are captured at any time, even if the case has never executed before, or will never execute.  Ok, The events will be captured, but will not be executed until in that case.
    And that's the reason why I have two separate event structures, in two separate phases of the program.
    Because, prior to page 6, the events will occur sequencially. The user will click somewhere, then some message will be transmitted over DataSocket, then some message may come , then again some user action and so on. But, when the user starts using page 6, there will be parallel process of user controls events and actions, and incoming messages and corresponding actions. For this, in the page 6, I need a different kind of execution. So I separated the two event structures.
    At first I thought to have SSM, and then I thought to PC, just because I can have two separate parallel processes - one for user events, and another for messages (because that way I can take maximum advantage of message tracking). But looking at other complexities, I find SSM more appropriate. Can you please tell me how can I have my message loop and events loop parallel to each other and just one event structure?
    You can have a dequeue function in your state machine loop and have it be a consumer loop.  Use a timeout on the Dequeue.  If there is a timeout, have the statemachine execute normally after that perhaps just passing the enum wire straight into the case structure of the state machine.  If it doesn't timeout meaning you got a message, then look at the message that is dequeued and act on it.  Perhaps it means ignoring the enum coming in from the shift register and changing the enum to something else to feed into the case structure of the state machine.  Attached is an example
    Attachments:
    PCDesign[1]_BD.png ‏6 KB

  • Why does unchecking the "use automatic configuration script" box on Internet Explorer 8 fix connectivity errors?

    As long as I have been in the job and we have been using IE as our browser, we have controlled the proxy settings with an automatic configuration file.
    Recently, with IE8 on WinXP and Win7, we have had situations with the user getting various connectivity errors. By unchecking the "use automatic configuration script" box, they start working. But we don't change anything else.
    These error are not consistent from machine to machine.
    We are in a AD Domain environment
    These are the two errors I have documented.
    Error: 5
    Description: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
    Access to resrouce is forbidden by server while attempting to access server at
    http://content.mpl.org/cgi-bin/admin/pwtest.exe?CISOVER=60.
    Please check the permissions to the file on th eserver.
    Two very different problems. Both somehow fixed by unchecking the box.
    The config file itself has not been changed in over a year.
    Can anyone explain why unchecking this box, but not making any other changes to the proxy settings would fix connectivity problems? These are all external sites that need to go through the proxy.
    Thanks.

    Hi,
    You can use the steps in the following thread to disable this option:
    uncheck "use automatic configuration script" in IE LAN settings 
    http://social.technet.microsoft.com/Forums/en-US/winserverGP/thread/05a7c683-075e-435c-8583-da8fd3559cf2
    Or try to
    reset Internet Explorer settings and select use automatic configuration script to see whether it could work.
    Hope this helps.
    Vincent Wang
    TechNet Community Support

  • Saving string array in Standard State Machine.

    I use a Standard State Machine to control a laser unit with multiple lasers. When I give the unit a command, it gives me much information back. When LabVIEW is reading this information, it is putting it in a string array.
    But the program shows only the information in the array when I enable 'Highlight Execution'.  What do I have to do to solve this problem?
    Thanks for all commands,
    Bjorn
    Attachments:
    StandardStateMachine 1.vi ‏26 KB
    statemachine.ctl ‏5 KB

    Does your device use a termination charcter at the end of each transmission?  You are already set up to use 0xA as a termination character (default on the Configure Serial Port).  If so, do not do the big mess with the checking of bytes at port and what not.  Just use a VISA Read with a very large number for the bytes to read.  The read will complete when that termination character is reached.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Handling menu selection in multi states of states machine

    Hi everyone,
    My application uses states machine architecture, I have to handle menu selection in two different states and the 2nd of them has to be handled by the event case structure.
    The problem is that when I use event structure in the 1st state it is also handled later by the event case in the 2nd state and it is impossible to handle menu selection in the 1st state by the "Get Menu Selection" block because according to it's descripton if event structure is configured to handle the same menu as item as this block, LabVIEW ignores this function.
    I would be greatful for any clue.
    Greetings,
    Mariusz
    Solved!
    Go to Solution.

    Thanks for respond.
    Here's a code explaining the main idea.
    Attachments:
    Untitled 1.vi ‏9 KB
    Enum_States.ctl ‏5 KB

  • Interested in your ideas for improving the JKI State Machine

    [cross-posted to LAVA]
    Hi LabVIEW'ers,
    Over at JKI, we've soft-launched a new idea exchange for the JKI State Machine:
    http://ideas.jki.net...-state-machine/
    I've seeded this with a couple ideas we've heard mentioned before.  If you're interested in providing your feedback on ways to make the JKI State Machine Better, we'd love to hear it!
    In addition to feature ideas, we're also interested in knowing what types of design patterns and application examples you'd like to see.
    Regards,
    -Jim

    Hi Wiebe,
    You're right that you don't get edit-time type checking with a string-based state machine (as opposed to an enum-based state machine) -- the up-side is that you get a much faster/flexible way to work on the state machine (such as having the ability to comment out state strings by prefixing with a "//" or "#", as our state string parser allows).  Also, we do have a special "Default" frame to catch states that are miss-spelled or not in defined in the Case Structure -- this will present a dialog and raise and error, by default.  And, it's possible that we could create some tools to do edit-time checking of the state strings against the Case Structure frames.
    Regarding state flow, there is the possibility of creating tooling that helps visualize state flow.  In a post on LAVA, Mikael Holmström posted an example of using the Endevo GOOP Development Suite to reverse engineer a state machine.
    This doesn't completely work, but it shows an interesting possibility.
    Thanks for offering to refer people to the JKI State Machine.
    Cheers,
    -Jim
    Message Edited by Jim Kring on 10-15-2008 09:40 AM
    Attachments:
    post-a10155-StateMachine.png ‏7 KB

  • Trying to use a proxy server automatic configuration script

    I have just started a new course and my university require every machine that connects to use a proxy configuration script and I am having a spot of bother getting it all set up.
    I have managed to get Firefox set up using the script (I was given a URL for the script and was able to get point the firefox settings at it.) Whilst this allows me to browse the web whilst on campus, it does not allow me to sync all my work to my git, svn and backup server, or in other words, anything that requires an internet connection.
    I am currently using Gnome 3, however, if it is easier to use this kind of thing, then I can switch off to another WM.
    If it helps, the URL for the config file is located here:  http://www-config.strath.ac.uk/proxy.config
    Thanks in advance for any help that can be offered.
    Edit: I tried sticking the url into the Proxy configuration URL bit in the Network settings screen, but that either doesn't work, or I don't know what I am doing (In all fairness, one is just as likely as the other)
    Last edited by nimmo (2011-09-02 21:46:21)

    Ah, I hadn't noticed it giving different contents when you grabbed it when off campus...
    I have  a copy that I downloaded yesterday here:
    function FindProxyForURL(url, host) {
    if (
    isInNet(dnsResolve(host),"130.159.0.0","255.255.0.0")
    || isInNet(dnsResolve(host),"10.0.0.0", "255.0.0.0")
    || isPlainHostName(host)
    || dnsDomainIs(host, "localhost")
    || isInNet(dnsResolve(host),"127.0.0.1","255.255.255.255")
    ) return "DIRECT";
    else if (
    shExpMatch(url, "http://www.gownhire.co.uk/*")
    || shExpMatch(url, "http://www.edeandravenscroft.co.uk/*")
    || shExpMatch(url, "http://launch01.strath.youth-unlimited.com/*")
    ) return "PROXY dangermouse.net.strath.ac.uk:8080";
    else if (
    shExpMatch(url, "http://*.facebook.com/*")
    || shExpMatch(url, "https://*.facebook.com/*")
    || shExpMatch(url, "http://*.fbcdn.net/*")
    || shExpMatch(url, "https://*.fbcdn.net/*")
    || shExpMatch(url, "http://*.bebo.com/*")
    || shExpMatch(url, "https://*.bebo.com/*")
    || shExpMatch(url, "http://*/gateway/gateway.dll*")
    || shExpMatch(url, "https://*/gateway/gateway.dll*")
    ) return "PROXY zloty-p.net.strath.ac.uk:8080";
    else return "PROXY tambala-p.net.strath.ac.uk:8080; PROXY kwacha-p.net.strath.ac.uk:8080; PROXY rouble-p.net.strath.ac.uk:8080";
    [rant]
    Looking more closely at the contents of that file, I am starting to be less impressed with the wireless service. At St Andrews I just had to install a certificate and setting up a WPA2-Enterprise profile and that was that, none of this logging into a web portal as if I was in a coffee shop hotspot nonsense.
    [/rant]

  • Help me with a state machine design

    I have a little bit of a problem.  I have a system with several modes, each selected by the user and called with a case structure.  Each case in the case structure is its own state machine with a few states (like 4-6).  Now here's the catch.  I need one of the states within one of the modes to call and execute an entirely different mode (and all of its states) without actually changing the mode command, and to do so every iteration until I jump out of that state into another state within the first mode.
    Is there a simple way to do that that I'm just not thinking of?
    Lee Jay

    Lee, my first thought would be to use just a big state machine.  For example if each mode needs 4 states, mode 1 gets states 0-3, mode 2 get states 4-7, and so on.  This way, if you need to change modes in the middle of another mode, you just direct the state selector to the state that starts the mode.  (If that makes sense).  It's not real elegant, but it works fairly well as you still maintain the flexibilty of the state machine design, including the ability to add and rearrange cases. 
    Don't forget you can use any method to select the cases, including strings, so you have full flexibility with how you setup case select.
    Troy

  • Calling states in a state machine more than once

    Hello again,
    Is there a way to call a state in a state machine after it has already ran? To elaborate, I have a program that will set pressure in increments of 20% and will then write to a file. Once it is done with the highest pressure state (100%), I want it to repeat the test again, but this time in decrements of 20%. So, it will do:
    1. Set pressure at lowest point
    2. Read meter and write value
    3. Set pressure at 20%
    4. Read meter and write value
    All the way up to 100%, then:
    5. Set pressure at 80%
    6. Read meter and write value
    7. Set pressure at 60%
    8. Read meter and write value
    All the way down to the lowest point.
    Is there a way to do this instead of making a state for read and writes at each percentage? That way I don't have Read Agilent 20% Increment, Read Agilent 40% Increment, etc.
    I've attached the code to help explain what I'm talking about.
    Thanks everyone, still a newbie
    Solved!
    Go to Solution.
    Attachments:
    Pressure&Measurements.vi ‏58 KB

    Yes, everything I described is automatic, no user intervention.  ( I edited my post, please review ).   As I understand what you are asking, you don't want to have multiple states where the only difference is the multiplier value. 
    But, you do already have all those states, so you can decide to re-write for flexibility and future expansion, or just index the state enum as described above.
    Missed the part about decrementing afterwards.  The idea is identical, you have an array that has the values you want in the order you want.  If the pattern repeats, then you have to reset the index to start at the beginning after each run.
    If you are going up then down, then repeating, I would suggest putting the values in order 20,40 ...100 ....  40, 20, and then repeat that sequence.
    Alternatively, you can use an array of the state names as you already have the 20, 40, ... etc...   states written.
    Mark Ramsdale

  • Workstation Manager service clears Automatic Configuration Script Properties.

    We have a weird problem where when the workstation manager service
    starts it clears the Automatic Configuration Script within Internet
    Explorer. Now out of our 400 odd PCs, only about 3 are doing it. For
    now we have counter acted it by putting in an actual Proxy Server in,
    but if we disable the workstation manager service, restart the PC, the
    Automatic scripting is still in place.
    We have gone through the group polices, and through the Zen
    policies, we can't work out where Workstation Manager is receiving its
    instructions to do this?
    We are running Novell Client 4.9.1 SP2, we applied SP2 for the client
    to see if this would resolve the error but it didn't
    Thanks in advance,
    Jim

    I will follow those instructions in that TID you supplied me, you can
    log in as any user, and even if you tick the workstation only box, the
    problem still occurs.
    Thanks,
    Jim
    Jared Jennings wrote:
    > Jim,
    >
    > > We have gone through the group polices, and through the Zen
    > >policies, we can't work out where Workstation Manager is receiving its
    > >instructions to do this?
    >
    > What if you unassociate all policies from the user and workstation that
    > this happens to?
    >
    > Does it matter who logs into the machine?
    > You might enable group policy logging to find which policy is doing this.
    > http://support.novell.com/cgi-bin/se...i?10093312.htm
    >
    > --
    > Jared Jennings
    > Data Technique, Inc.
    > Novell Support Forums Sysop
    > http://wiki.novell.com

  • Need help setting up a Finite State Machine in BlueJ

    Hey all, I joined these forums to hopefully help me catch up with my Java skills. I haven't programmed in Java for almost a year, and the class I'm in now does little for review so I'm rusty to say the least. The assignment we were given recently is to create a Finite State Machine resembling a gumball machine. This are basically the requirements given:
    The operation of the gumball machine is simple. It takes a quarter to get a gumball dispensed. The customer needs to deposit a quarter and turn the crank, and a gumball will be dispensed if the machine contains one or more gumballs.
    Design steps:
    There are a number of states: No_Quarter, Has_Quarter, Gumball_Sold, Out_of_Gumballs
    Create an instance variable to hold the current state and define values for each of the states.
    All the actions that can happen in the system are: insert_quarter, ejects_quarter, turns_crank, dispense_gumball, and refill_gumballs. The action dispense_gumball is an internal action the machine invokes when it reaches the Gumball_Sold state.
    Create a class that acts as the state machine. For each action, create a method that uses conditional statements to determine what behavior is appropriate in each state.
    Write a test program to test the GumballMachine class. You consider not just normal operations i.e. insert a quarter, turn the crank; but also operations such as insert a quarter, eject the quarter, turn the crank. Or what if you turn the crank twice after insert one quarter. Or what if you insert two quarters in a row.
    Now trust me, I'm not asking for someone to come here with a hunk of code and say, ok use this, and it's done. What I'm here for is hopefully someone can walk me through the right thought process of how to implement the states, and where/how to include the actions to go along with the states. We're to use BlueJ to write the code, and I'm still pretty unfamiliar with its arrow system that tells Test Programs to use the linked class(es).
    Thanks for any help in advance, and for what it's worth, speedy responses are especially appreciated!

    Did you upload everything to your server?  Did you perform the compatibility check?
    FormCaptcha’s requirements:
    PHP 4.0 or later.
    GD Library for PHP, version 2.0 or greater (it's installed on most web servers but it may not be enabled).
    The page that processes the form must have .PHP extension.
    Tip: If you want to be sure that your web server supports this captcha tool, then you can download and test our free captcha compatibility check. This is a script that checks if your web server can generate captcha images and perform the captcha validation.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/

  • If Statement in SAP Scripts

    Hi All,
    I have written the below If statement in  SAP scripts but when i execute the same the controll doent check the second line entries. If firtst line doesnot satisfy it goes to the else part. Kindly suggest what is wrong in this..
    /:           IF &T156T-BWART& = '321' OR &T156T-BWART& = '322' OR
    /:           &T156T-BWART& = '349' OR &T156T-BWART& = '350' OR
    /:           &T156T-BWART& = '312' OR &T156T-BWART& = '326' OR
    /:           &T156T-BWART& = '343' OR &T156T-BWART& = '344'.
    /:           ELSE
    /:           ENDIF.

    Hi neha,
    Try to use the '/E' fo rnext line
    /E->Extended line
    Here is a code:
    /: IF &T156T-BWART& = '321' OR &T156T-BWART& = '322' OR
    /E  &T156T-BWART& = '349' OR &T156T-BWART& = '350' OR
    /E  &T156T-BWART& = '312' OR &T156T-BWART& = '326' OR
    /E &T156T-BWART& = '343' OR &T156T-BWART& = '344'.
    /: ELSE
    /: ENDIF.
    Hope this helps you.
    Regards,
    Rajani

  • Use of IF statement in SAP Scripts

    Can u tell me how to use IF statement in SAP Scripts.
    The problem is
    if &sy-tabix& eq '1'
    total
    else
    total1.
    endif.
    this sy-tabix is not working

    i think sy-tabix will not work here....
    do like this..
    data : vtabix type i.
    loop at itab.
    vtabix = sy-tabix.
    write_form...for the text element..
    endloop.
    in form layout
    /: if &vtabix(c)& eq 1
    /:endif
    regards
    shiba dutta

Maybe you are looking for