EL Expression Eval

Hi all,
Using JDeveloper 11.1.1.6.0
I have a jsff that I would like to invoke an EL expression that will simply instantiate an application scope bean if it isn't instantiated yet. What would be the most efficient way to do this? I'm guessing <af:outputtext>?
Thanks!

Really good point BK - I had added it initially as a test to make sure that it was only instantiated once and hadn't thought about how the jsff would use it. I think you are right - once we get the code that uses the bean we won't need to force it. Marking as answered.
Thanks!

Similar Messages

  • NEED HELP:To Parse Conditional Operator Within An Expression.

    Hi there:
    I'm having some difficulties to parse some conditoional operator. My requirements is:
    Constants value: int a=1,b=2,c=3
    Input/Given value: 2
    conditional operator expression: d=a|b|c
    Expected result: d=true
    Summary: I like to receive a boolean from anys expressions defined, which check against Input/Given value.Note: The expression are various from time to time, based on user's setup, the method is smart enough to return boolean based on any expression.
    Let me know if you have any concerns.
    Thanks a million,
    selena

    here is a simple example.
    BNF changes
    EXPR ::= OPERATOR
    EXPR ::= OPERATION OPERANT EXPR
    This is as far as I can go, please use it as a template only
    because you need to take into account the precedence using ()
    the logic of the eval was simply right to left so I think it is not what you want
    Cheers
    public interface Expression
         String OR = "|";
         String AND = "&";
         public boolean eval(int value) throws Exception;
    public class ExpressionImpl implements Expression
         public String oper1;
         public String operant;
         public Expression tail;
         /* (non-Javadoc)
          * @see parser.Expression#eval()
         public boolean eval(int value) throws Exception
              int val1 = getValue(oper1);
              if (null == tail)
    System.out.println(val1 + ":" + value);               
                   return (val1 == value);
              else
                   if (OR.equals(operant))
                        return (val1 == value || tail.eval(value));
                   else if (AND.equals(operant))
                        return (val1 == value && tail.eval(value));
                   else
                        throw new Exception("unsupported operant " + operant);
         private int getValue(String operator) throws Exception
              Integer temp = ((Integer)Parser.symbol_table.get(operator));
              if (null == temp)
                   throw new Exception("symbol not found " + operator);
              return temp.intValue();
         public String toString()
              if (null == operant) return oper1;
              return oper1 + operant + tail.toString();
    public class Parser
         public static HashMap symbol_table = new HashMap();
          * recursive parsing
         public Expression parse(String s)
              ExpressionImpl e = new ExpressionImpl();
              e.oper1 = String.valueOf(s.charAt(0));
              if (s.length() == 1)
                   return e;
              else if (s.length() > 2)
                   e.operant = String.valueOf(s.charAt(1));
                   e.tail = parse(s.substring(2));
              else
                   throw new IllegalArgumentException("invalid input " + s);
              return e;
         public static void main(String[] args) throws Exception
              Parser p = new Parser();
              Parser.symbol_table.put("a", new Integer(1));
              Parser.symbol_table.put("b", new Integer(2));
              Parser.symbol_table.put("c", new Integer(3));
              Parser.symbol_table.put("d", new Integer(4));
              Expression e = p.parse("a|b|c&d");
              System.out.println("input " + e.toString());
              System.out.println(e.eval(2));
    }

  • Process controlled Workflow is not starting

    Hi,
    I have problems with implementing an own process-controlled workflow. The "Sample BC Set for Process Level Definition" /SAPSRM/C_SC_600_001_SP04 is working fine. However I do not succeed in triggering a customer Process Schema for BUS2121.
    The (first?) problem can be duplicated as following:
    1. BC-Set /SAPSRM/C_SC_600_001_SP04 is activated
    1.1 When creating a shopping card (Web Portal) a approver ("Head of organizational unit" in OrgManagement) is displayed in the Details (Approval-Workitem is created when saving the shopping cart)
    --> OK
    2. Deactivation of Process Schema 3C_SC_600_001 (replace Eval.IDs with customer Eval.ID which contains always false expression)
    --> When creating a shopping card (Web Portal) no approval data is displayed in the Details 
    --> OK
    3. Copy Process Schema 3C_SC_600_001 into ZC_SC_600_001; replace customer Eval.ID with original Eval.IDs (Boole; no process schema in expression (Eval-ID 3EV_SC_600_001_100; Expression 3B_SC_600_001_100: "Execute always"))
    --> When creating a shopping card (Web Portal) no approval data is displayed in the Details 
    --> NOT OK; the same result as with 1.1 is expected
    Why is 3. not working? Any ideas would be very welcome.
    Best regards

    In most cases, this means that the 'Start Process' is not configured correctly. Take a look at the following:
    1. make sure that the Wf assigned to your start process is active
    2. make sure that reference numbers are configured and assigned to your process
    3. assign a user to receive error messages when an error occurs
    Thanks,
    Derrick Banks

  • SRM 7.0 Process-controlled Workflow not starting

    Hi,
    I have problems with implementing an own process-controlled workflow. The "Sample BC Set for Process Level Definition" /SAPSRM/C_SC_600_001_SP04 is working fine. However I do not succeed in triggering a customer Process Schema for BUS2121.
    The (first?) problem can be duplicated as following:
    1. BC-Set /SAPSRM/C_SC_600_001_SP04 is activated
    1.1 When creating a shopping card (Web Portal) a approver ("Head of organizational unit" in OrgManagement) is displayed in the Details (Approval-Workitem is created when saving the shopping cart)
    --> OK
    2. Deactivation of Process Schema 3C_SC_600_001 (replace Eval.IDs with customer Eval.ID which contains always false expression)
    --> When creating a shopping card (Web Portal) no approval data is displayed in the Details
    --> OK
    3. Copy Process Schema 3C_SC_600_001 into ZC_SC_600_001; replace customer Eval.ID with original Eval.IDs (Boole; no process schema in expression (Eval-ID 3EV_SC_600_001_100; Expression 3B_SC_600_001_100: "Execute always"))
    --> When creating a shopping card (Web Portal) no approval data is displayed in the Details
    --> NOT OK; the same result as with 1.1 is expected
    Why is 3. not working? Any ideas would be very welcome.
    Best regards

    Hi..
       what do you see in SLG1? .. i think your process level Eval.id result is false, that is the reason workflow is not kicking of 
    1- level approval.. check your process level configure and try to use 0ev000 as a Eval.Id instead your custom Eval.Id and test..
    Saravanan

  • URGENT: Parse Logical Operator.

    Hi there:
    I'm having some difficulties to parse some conditoional operator. My requirements is:
    Constants value: int a=1,b=2,c=3
    Input/Given value: 2
    conditional operator expression: d=(a|b|c)&d
    Expected result method:false
    Summary: I like to receive a boolean from any conditional operator expressions defined, which check against Input/Given value.
    Note: The expression are various from time to time, based on user's setup, the method is smart enough to return boolean based on any expression.
    Let me know if you have any concerns.
    Thanks a million,
    selena

    Hi Guys:
    I have modified your program to cater the "(" or ")" precedence. My techniques are:
    For eg : formula = (a|b|c)&d
    1. I substring the those expression with "(" and close with ")".
    2. Then, i store the substring value into a list.
    3. Inside the list will have 2 rows: (a|b|c), x&d (note: x is the input value store in the hashtable)
    4. Therefore basically, the first row (a|b|c) will return a true boolean, then i will store inside result list, and same goes to the result of x&d, which is false.I will get the last operand to store inside the list as well.
    5. The result list will have 3 rows with
    true
    false
    Question here:
    How can parse the rows in a single if statement ? I was tried to retrieve out and form a string, but i can't do that ....
    p/s my code maybe lousy, but pls guide me along the away, again i wish to learn from you :-).
    Again, duke dollars will be awarded when the solutions is firm.
    Thanks a millions,
    selena
    import java.util.List;
    import java.util.ArrayList;
    public class Parser
    public static HashMap symbol_table = new HashMap();
    public Expression parseList(List expList)
    ExpressionImpl e = new ExpressionImpl();
    StringBuffer strBuffer = new StringBuffer();
    List listFlag = new ArrayList();
    boolean result = false;
    String s = new String();
    String x = "";
    if( expList != null){
    for(int y=0;y<expList.size();y++){
    s = (String)expList.get(y);
    System.out.println("==> s: "+s);
    if(s.length()==2){
    s = "x"+s;
    System.out.println("==> after s: "+s);
    e.oper1 = String.valueOf(s.charAt(0));
    System.out.println("==> e.oper1: "+e.oper1);
    if (s.length() == 1){
    return e;
    }else if (s.length() > 2){
    e.operant = String.valueOf(s.charAt(1));
    System.out.println("==> e.operant: "+e.operant); e.tail = recursiveParse(s.substring(2));
    System.out.println("==> AFTER e.operant: "+e.operant);
    try{
    System.out.println(e.eval(2));
    result = e.eval(2);
    }catch(Exception ex){
    ex.printStackTrace();
    if(s.length() == 3){
    listFlag.add(e.operant);
    listFlag.add(Boolean.valueOf(result));
    System.out.println("==> s.length(): "+s.length()); System.out.println("==> e.tail: "+e.tail);
    }//end for
    }//end if
    if(listFlag !=null){
    for(int y=0;y<listFlag.size();y++){
    if(y==1){
    String operand = (String)listFlag.get(y);
    System.out.println("operand: "+operand);
    }else{
    if(y==0){
    boolean temp1 = ((Boolean)listFlag.get(y)).booleanValue();
    System.out.println("temp1: "+temp1);
    }else{
    boolean temp2 = ((Boolean)listFlag.get(y)).booleanValue();
    System.out.println("temp2: "+temp2);
    }//end for
    System.out.println("result: "+temp1 && temp2);
    /* if(temp1 operand temp2){
    return e;
    }//end method
    public Expression recursiveParse(String s)
    ExpressionImpl e = new ExpressionImpl();
    e.oper1 = String.valueOf(s.charAt(0));
    if (s.length() == 1){
    return e;
    }else if (s.length() > 2)
    e.operant = String.valueOf(s.charAt(1));
    e.tail = recursiveParse(s.substring(2));
    }else
    throw new IllegalArgumentException("invalid input " + s);
    return e;
    public static void main(String[] args) throws Exception
    Parser p = new Parser();
    Parser.symbol_table.put("a", new Integer(1));
    Parser.symbol_table.put("b", new Integer(2));
    Parser.symbol_table.put("c", new Integer(3));
    Parser.symbol_table.put("d", new Integer(4));
    Parser.symbol_table.put("x", new Integer(2));
    //The formula
    //Expression e = p.parse("(a|b|c)&d");
    //Split the String if found brackets and add into list
    String s= "(a|b|c)&d";
    String str = new String(s);
    int startIndex = str.indexOf("(");
    System.out.println("starting index with ( ==> "+startIndex);
    int endIndex = str.indexOf(")");
    System.out.println("endding index with ) ==> "+endIndex);
    String startString = str.substring(startIndex, endIndex+1);
    String endString = str.substring(endIndex+1, s.length());
    String firstSplit = s.substring(1,(startString.length())-1);
    System.out.println("1st split bracket value ==> "+firstSplit);
    System.out.println("endString ==> "+endString);
    System.out.println("endString length==> "+endString.length());
    List formulaStr = new ArrayList();
    formulaStr.add(firstSplit);
    formulaStr.add(endString);
    Expression e = p.parseList(formulaStr);
    //5.To evaluate the value of "2"
    //System.out.println(e.eval(2));
    public class ExpressionImpl implements Expression
    public String oper1;
    public String operant;
    public Expression tail;
    /* (non-Javadoc)
    * @see parser.Expression#eval()
    public boolean eval(int value) throws Exception
    int val1 = getValue(oper1); //Get the value of "a"/"b"/"c"/"d"
    if (null == tail)
    System.out.println(val1 + ":" + value);
    return (val1 == value);
    else
    if (OR.equals(operant))
    return (val1 == value || tail.eval(value));
    else if (AND.equals(operant))
    return (val1 == value && tail.eval(value));
    else
    throw new Exception("unsupported operant " + operant);
    private int getValue(String operator) throws Exception
    Integer temp = ((Integer)Parser.symbol_table.get(operator));
    /*if (null == temp)
    throw new Exception("symbol not found " + operator);
    return temp.intValue();
    public String toString()
    if (null == operant) return oper1;
    return oper1 + operant + tail.toString();
    public interface Expression{
    String OR = "|";
    String AND = "&";
    String START_BRACKET="(";
    String CLOSE_BRACKET=")";
    public boolean eval(int value) throws Exception;

  • Finding an example to run on labview 7 w/6025E

    We bought a 6025E, have the Labview 7 Express eval SW. It appears that we can only modify existing code so it appears to us that we have to find a suitable example to run on our system. (OT we spent a lot of time looking for something called DIO Port 2.vi for one of the examples)
    DOes anyone out there have example code that we can use to evaluate labview 7 and the 6025E?
    Many thanks for reading, more of course for any assistance......
    Rob Roy

    "Hello JDesRosier;
    Yes, we have purchased a 6025E card and want to evaluate which application (Labview Express or LabWindows) to purchase. Our plan is to use the demo of labview 7 express first to develop a simple test, and then use the labwindows demo to develop and evaluate the same test. This would give us a good feel (we thought) for which product we want to purchase. Our problem appears to be that without a license (Labview or LabWindows) we can only modify an existing task, channel, or scale according the measurement explorer. We are not sure what that (Message from ME) really means except that we are left to wonder what it means not having experience with the products.
    We need an example program that we can use directly or modify for the 60
    25E card that will give us a sense of what the test programming will be like in Labview 7 express. Our test scenario is to set a state, read our inputs, wait a period of time, change state, read our inputs, wait a period of time. We would like to use a spread sheet form to control the output states and compare the input states against, as well as set the period of time for each state. Setting a state includes setting the direction register for those ports or bits that can be set. If this is an easy demo or if it already exists in a state that we should be able to use and evaluate then please point us to the right location or source.
    Our operating system is Windows XP Pro, internet connected, and can be set to host for GOTOMYPC or Windows remote assistance should there be an active interest in getting us going. We have a contractor in house whose job it was to set up a demo test but we are afraid that we shackled his efforts by not having the software already purchased. Is this a f
    air assumption?
    Your thoughts, assistive actions, and criticism is welcome.
    Sincerely,
    Rob Roy

  • FDM validation rule

    Hi all, I have FDM 11.1.2.1 and during the testing of a validation rule I'm getting the follow
    Round(28367722753347.5,0)=Round(28367722753347.4,0)
    FALSE
    The rule is this
    Round(|,,,,,,R93,[ICP Top],AJUSTADO,SALDO,[None],[None],,,,,,,,,,,,,,,,|,0)=Round(|,,,,,,R96,[ICP Top],AJUSTADO,SALDO,[None],[None],,,,,,,,,,,,,,,,|,0)
    Why is this giving False as a result ???
    Also is there a way to have FDM to do the expression eval by selecting this Round(28367722753347.5,0) ??? All I get is Expected ')'
    Thanks for your help
    Edited by: HFMColUser on Nov 23, 2011 6:46 PM

    Thanks for your answer, I saw the result of your test ... thanks a lot I actually feel kind of stupid for not seeing that before.
    About the second part or my question I'm refering about the Test tab, when you have an actual validation rule (not just Round(x,y)), once you select the entity and hit the test rule button all the fields on the screen get filled.
    On the Expression field it shows the rule
    Round(|,,,,,,R93,[ICP Top],AJUSTADO,SALDO,[None],[None],,,,,,,,,,,,,,,,|,0)=Round(|,,,,,,R96,[ICP Top],AJUSTADO,SALDO,[None],[None],,,,,,,,,,,,,,,,|,0)
    On the Expression after Look up substitution (Scratch Pad) field it shows the replacement of the fields, it looks something like
    Round(28367722753347.5,0)=Round(28367722753347.4,0)
    Now my question was about the bottom right button called "Expression Eval", what's its function ??
    I highlighted Round(28367722753347.5,0) (on the scratch pad) and then used the Expression eval button, then an error message showed up with the phrase Expected ')'
    but when I highlight for example Int(28367722753347,5) (on the scratch pad) and then use the Expression eval button it shows me 28367722753347.
    Is there a problem with the round function and it cannot be evaluated through that method ???
    Thanks again for your interest and help

  • Any ideas why i would get this while trying to run label claims?

    ErrorType: First| ErrorCount: 0| App: GSM| SessionId: d5058fc1-8533-41d0-7a95-65c790351c89| UserId: EEEEEEEE | IsNewSession: False| ServerID: | Misc: Spec 2004447-023 ; | Exception: System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> Xeno.Prodika.Common.ProdikaException: Error caught while attempting to parse Label Claims ---> Microsoft.JScript.JScriptException: Expected expression eval code: Line 3 - Error: Expected expression --- End of inner exception stack trace --- at Xeno.Prodika.LabelClaimService.LabelClaimsJScriptEvaluatorService.EvaluateFormulaScript(IDynamicEvaluator evaluator, ILabelClaimEvaluatorContext ctx) at Xeno.Prodika.LabelClaimService.Evaluator.LabelClaimInstanceRulesetEvaluator.Evaluate(ILabelClaimEvaluatorContext ctx) at Xeno.Prodika.LabelClaimService.Evaluator.LabelClaimEvaluator.Evaluate(ILabelClaimEvaluatorContext ctx) at Xeno.Prodika.LabelClaimService.LabelClaimsService.Evaluate(ILabelClaimEvaluatorContext ctx) at Xeno.Web.UI.GSMExtensions.LabelClaims.UIService.LabelClaimsUIService.Evaluate() at Xeno.Web.UI.GSMExtensions.LabelClaims.Tabs.ctlDetermination.get_Claims() at Xeno.Web.UI.GSMExtensions.LabelClaims.Tabs.ctlDetermination.BindGrid() at Xeno.Web.UI.GSMExtensions.LabelClaims.Tabs.ctlDetermination.OnLoad(EventArgs args) at

    Does the label claims interrogation process run for "inactive" claims too, and just not display them, or does it only run the calculations on "active" "is calculatable" claims?

  • Recursive Problems

    While trying to figure out if the recursive definition in java is innermost, outermost, ...
    I stumbled upon a problem. Why is it that running "return eval(x--, eval(x , y));" or running "return eval(x - 1, eval(x , y));" yeilds different results. Please try running one and then the other before replying. I'm well aware or the fact that x-- is an autodecrementation and x - 1 doesn't store the value into x, but my reursive calls take care of that.
    If there is an easier way to determine Java's recursive definition please let me know.
    public class RecurF
         public RecurF()
              System.out.println(eval(1, 1));
         public int eval(int x, int y)
              System.out.print(x + " other ");
              if(x == 0)
                   return x;
              System.out.print(x + " ");
              return eval(x--, eval(x , y));
              //return eval(x - 1, eval(x , y));
         public static void main(String [] arg)
              RecurF test = new RecurF();
    }

    I stumbled upon a problem. Why is it that running
    "return eval(x--, eval(x , y));" or running "return
    eval(x - 1, eval(x , y));" yeilds different results.First of all, the expression
      eval(x--, eval(x , y))has undefined semantics, because you are modifying x inside the expression. The compiler is free to generate code that evaluates the second parameter before the first parameter, or the other way around.
    This is true for any language, and Java does not enforce a particular order of evaluation of arguments, or even the order of evaluation and calling (i.e. the compiler is free to do something like:
      t1 = x--;
      t2 = y;
      t3 = x;
      t4 = eval(t2,t3);
      eval(t1,t4);If you have variable modification side-effects in an expression, you need to make sure that you don't use any of the affected variables more than once in the same statement (because the sequence point is the statement boundary).

  • [svn] 3308: QE: yes - method on HTTPMultiService fixed

    Revision: 3308
    Author: [email protected]
    Date: 2008-09-22 20:19:51 -0700 (Mon, 22 Sep 2008)
    Log Message:
    QE: yes - method on HTTPMultiService fixed
    HTTPMultiService.rootURL -> baseURL - it is interpreted as a directory name, not a file name like rootURL
    endpoint now works on mx.rpc.remoting.RemoteObject (not just the mxml variant)
    also promoted concurrency and showBusyCursor to RemoteObject
    removed RTE from getOperation for HTTPMultiService as it messes with data binding expressions eval'd before the operation is added
    Docs: properties above moved from mxml.RemoteObject to RemoteObject, ASdoc changes for HTTPMultiService
    Blazeds checkintests pass
    Reviewer: Pete
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/http/AbstractOperation.as
    flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/http/HTTPMultiService.as
    flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/http/Operation.as
    flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/remoting/Operation.as
    flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/remoting/mxml/Operation.as
    flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/remoting/mxml/RemoteObject.as

    cju wrote:Try including your graphic module into your initramfs.
    (EDIT: Question unnecessary, found out how, thank you lots for suggestion!)
    How can I mkinitcpio into my current initramfs? It doesn't seem to write into the actual one unless specified to it
    Last edited by M4R10zM0113R (2015-01-17 20:07:14)

  • Why do in-line conditiona​l expression​s work in Formula Node but not in 'Eval Formula Node.vi'?

    'Eval Formula Node.vi' and a standard Formula node seem identical in most respects in terms of their functionality, however I'm stumped by the case of inline conditional expressions. 
    I'd like to read in a string in the syntax "(expr)?(expr)expr)" from a text file and recieve the output as a double.
    The subVI seemed like the perfect tool since I was already using it to interpret a number of other calculations within the text file, however in this case the behavior is not as expected.
    Has anyone else ever tried this? is there a different syntax needed between the two tools?
    Are there other features of the Formula Note not replicated by this VI?  (so I can avoid them in future)?
    For simplicity I've attached a little demo of the behavior.
    I am currently working in 2010, which I know is getting on in years.
    If the behavior is improved in later versions, that may be a good excuse to upgrade :-) 
    Thanks,
    Elaine R.
    Attachments:
    Conditional Formula Node demo.vi ‏13 KB

    .aCe. wrote:
    Eval formula Node does not do any conditional expressions as far as I am aware.
    That is right. It's a rather dirty hacked VI library to do some formula evalution and has many limitations in comparison to the Formula Node including no support for conditional operator as well as some others. In addition it can also error on some more complex bracketed expressions.
    It is an old example VI that was never revisited and probably never will be as writing a new one from scratch would be easier. But considering that the Formula Node and Mathscript and other possibilities exist, this is not likely going to happen soon.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • In built eval function for Logical expression?

    I want to create a eval function to evaluate logical string expression like a==b?true:false which comes as a String. Is there anything provided by Flex

    If you have EXP utility installed on your machine, a button trigger you can do:
    HOST('EXP SCOTT/TIGER FILE=C:\Backup.dmp TABLES=(EMP, DEPT)');This will work both in client/server and web deployed, but in web deployed forms it will run on the application server and not the client machine.
    To run it on the client machine you must use CLIENT_HOST.
    Tony

  • Eval simple expressions

    I need to provide dynamic evaluation of simple expressions from within an application, and don't want to re-invent the wheel by implementing yet another expression language. I wish Java had a package for dynamic evaluation of simple expressions (can't believe it doesn't), but javascript expressions would be just fine., so I"ve been looking into that.
    Unfortunately, the "obvious" javascript eval function made available to Java (in JSObject) seems to require an Applet within a browser context. (I'm sorry, are applets the only place where javascript is useful???)
    Anyway, can anyone suggest how to eval javascript expressions, or suggest an alternative language whose expressions can be evaluated from Java code without too much effort. I don't need to use javascript -- just thought it was a no-brainer until I started trying to actually do it.

    JFormula is a complete evaluation system working with various types (string,double,bigdecimal,boolean...). You can use if/then/else expression and
    plug your functions or operators...
    http://www.japisoft.com/formula/index.html

  • Eval formula node expression​s

    Hi
    What are the acceptable formula inputs for the Eval Formula Node VI?
    The help files do not mention much. It took me a long time to work out that 2*pi needed to be written pi(2).
    I would also like to know if I can perform 'if' statements and what the correct syntax is.
    My application uses two inputs (an integer and a voltage reading), a formula that the user enters (eval formula node vi), and an output number (DBL).
    UniSA, Mawson Lakes, South Australia - LV 8.6.1
    Attachments:
    FormulaNodeExampleLV8_6.vi ‏12 KB

    Hi mikie121
    Take a look here. The  syntax, operators, and functions links will be what you are looking for.
    Joe Daily
    National Instruments
    Applications Engineer
    may the G be with you ....

  • "Eval Parsed Formula Node VI" does not return outputs in predefined order

    I make a data analysis program, where the data consists of some million events and each event has e.g. 4 channels and 1-5 hits on each channel. 
    I would like the user to select different expressions of these channels to give coordinates to plot in a 2D histogram (increment a bin in Intensity Graph), e.g. for some experiment you want to show x=ch1-ch2; y=ch1+ch2+ch3+ch4; while in another experiment you want x=ch1-123; y=123-ch2;
    There are other VIs that use static LabView-code for the normal things, but now after a few years of adding to this program I find that it would be quite good with a general plotter and let the user specify simple expressions like this. Also with the "normal" static plots, there is a need to filter out bad data and then it would be much simpler both to program and use if you could write text expressions with boolean logic to combine multiple filters. Making a LabView code and GUI that allows AND/OR/parenthesis combinations of expressions will be quite an effort and not very reusable.
    So, with the above motivation, I hope you see that it would make sense to have a useable string formula evaluator in LabView. I find some info about MathScript's user-defineable functions, but haven't managed to get MathScript working in LV2010 yet (maybe some licensing or installation issues, I think I had it in 8.6). But I think it would be possible to do most of what I want for the display-part (not the filtering) with the simpler Eval/Parse Formula Node VIs and suitable use of the limited variable name space. So I started testing, and found a quite annoying issue with how the evaulator works.
    To the parser, you are expected to send an array of output variable names. But then it ignores this array, and returns one output per assignment/semicolon in the formula, in the order of the formula text. Since the static parts of my program need to know what the output values mean (which of them is x and which is y), I would have to rely on the user not using any intermediate variable and defining x before y. The attached screenshot demonstrates the problem, and also that it has been solved by NI statff in the "Eval Formula Node VI" which does the appropriate array-searching to extract only the pre-defined outputs, in their expected order. But using that VI is about 100 times as slow, I need to pre-compile the formula and then only use the evaulator in the loop that runs over a million events.
    I don't know if I'll take the time to make my own tweks to the parsing stage (e.g. preparation of array-mapping to not have to repeat the search or maybe hacking the output list generated by the parser) or if I'll have to make it in a static Formula Node in the block-diagram (which supports more functions), so that the user has to run with development environment and stop the program to change the plotting function. But I wanted to share this trouble with you, in hope of improvments in future LabView versions or ideas from other people on how I could accomplish my aim. I have MATLAB-formula node possibility too, but is far as I have seen the only place the user could update the formula would then be in a separate .m file, which is re-read only when typing "clear functions" in the Matlab console window. (Having this window is also an annoyance, and perhaps the performance of calling Matlab in every iteration is not great.) 
    Besides this issue, it also seems very strange there is virtually no support for conditional expressions or operators in Formula Node evaulated formulas (called Mathematics VIs in the documentation). Maybe using (1+sign(a-b))/2 you can build something that is 0 when a<b and 1 when a>b, but it is not user friendly! Would it really be diffcult to add a function like iif(condition, return_value_if_true, return_value_if_false) to replace the unsupported "condition ? if_true : if_false" operator? Would it really be difficult to add support for the < <= >= > == || && operators? Although compiled to an assemply language, this can't exactly be difficult for a CPU.
    Attachments:
    LV script test.png ‏62 KB
    LV script test.vi ‏18 KB

    (1) You can put any kind of code inside an event structure with the limitation that it should be able to complete quickly and without user interaction.  For example a while loop for a newton-raphson method is fine, but an interactive while loop where the stop condition depends on user iteraction is not recommended. By default, event structures lock the front panel until the event completes, so you would not even be able to stop it.
    (2) Yes, you can do all that. LabVIEW has no limitation as a programming language. Use shift registers to hold data and state information, the manipulate the contents as needed.
    (3) I would recommend to use plain LabVIEW primitives instead of formula nodes. Show us your code so we can better see what it's all about. Obviously you have a mismatch betweeen scalars and arrays. It is impossible from the given information where the problem is.
    (4) Yes, look inside the nonlinear curve fit VI (you can open it an inspect the code!). One of the subVIs does exactly that. Just supply your model VI.
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for