Dynamic Expression Evaluation in AS 3

Hi all,
AS 2 had the eval() function, but it was removed in AS 3. Does anyone know of a way to dynamically evaluate an expression in AS 3+?
I'm trying to impliment a feature that allows a user to define the behavior of a component based on the evaluation of an expression (composed of  conditional, logical and grouping operators which operate on constants and remote data sources).
Any ideas how one might do that using the current Flex toolset and or 3rd party libs?
Thanks in advance,
Carl
PS - Anyone ever use this libarary:
http://code.google.com/p/flexeval/
Doesn't seem like there is much activity there.

U can use it like any other netui tag.
Kunal Mittal

Similar Messages

  • Dynamic expression evaluation in netui:param

    Hi,
    Is there any way to send dynamic values(numbers) to <netui:param> tag 'value' attribute, pl. let me know as soon as possible.
    Thanks in Advance,
    sugan

    U can use it like any other netui tag.
    Kunal Mittal

  • [svn] 3045: Fix FB-13900: Expression Evaluator: 'is' and 'as' expressions return 'Target player does not support function calls'

    Revision: 3045
    Author: [email protected]
    Date: 2008-08-29 10:59:25 -0700 (Fri, 29 Aug 2008)
    Log Message:
    Fix FB-13900: Expression Evaluator: 'is' and 'as' expressions return 'Target player does not support function calls'
    Ticket Links:
    http://bugs.adobe.com/jira/browse/FB-13900
    Modified Paths:
    flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/BinaryOp.java
    flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSession.java

    Revision: 3045
    Author: [email protected]
    Date: 2008-08-29 10:59:25 -0700 (Fri, 29 Aug 2008)
    Log Message:
    Fix FB-13900: Expression Evaluator: 'is' and 'as' expressions return 'Target player does not support function calls'
    Ticket Links:
    http://bugs.adobe.com/jira/browse/FB-13900
    Modified Paths:
    flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/BinaryOp.java
    flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSession.java

  • Follow-up Dynamic expression in interface

    I created this thread so I can give credits to anyone helps me on this.
    I tried to follow the following thread and got some errors.
    Dynamic expression in interface
    When I execute the interface alone with out Java procedure(<@=result@>) its working.
    In the package the first step is Java procedure. The second step is the interface. When I execute the package its failing at the interface level even if I don't call the procedure result in the interface. Any idea.
    Dev - Yes I am using the same context
    -app

    When I right click and execute its working without the Java Procedure result in the interface.
    When I execute as a package I am getting same error message with or with out the procedure variable in the interface at the step "Insert flow into I$ table"
    Following is the command from the execution tab where its failing.
    insert into STAGING.I$_DYNAMIC_TABLE_1
         SRC_TAB_COLUMN,
         SRC_TAB_COLUMN_VALUE,
         PRODUCT_NAME,
         PRODUCT_NAME_1
    select
         DYNAMIC_TABLE.SRC_TAB_COLUMN,
         DYNAMIC_TABLE.SRC_TAB_COLUMN_VALUE,
         DYNAMIC_TABLE.PRODUCT_NAME,
         <@=result@>
    from      STAGING.DYNAMIC_TABLE DYNAMIC_TABLE
    where     
         (1=1)

  • How to use the Dynamic Expression in BRFplus

    Hi Experts
                   I am new to BRFplus. Can you give any document on BRFplus how to use the Dynamic Expression.
    Thankyou
    Venkat

    OK I tried it and worked but for one condition:
    WHERE DECODE (E.qualification_sid, 1104,
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.spe_per)+1),
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.mili_yea_per)+1))
         BETWEEN TO_DATE('01-07-2011', 'DD-MM-RR') AND TO_DATE('31-07-2011', 'DD-MM-RR')
    But how to put two conditions for the same Expression:
    WHERE DECODE ((E.qualification_sid, 1104) AND (E.RANK_SID, 8),
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.spe_per)+1),
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.mili_yea_per)+1))
         BETWEEN TO_DATE('01-07-2011', 'DD-MM-RR') AND TO_DATE('31-07-2011', 'DD-MM-RR')
    The previous code gives me this error: missing right parenthesis

  • Dynamic expression in interface

    Hi All
    Could someone share a way how to create dynamic expression in ODI interface. Eg. I have metadata and want to build case expression on its basis and use it in interface.
    I have tried several possibilities:
    1) Use Java program in mapping expression.
    But during interface steps creation getJDBCConnection() method returns null for both SRC and DEST.
    Is there is a way how to connect to database?
    2) Generate expression in procedure and use it in interface
    Is there is a way how to pass string from procedure to interface?
    3) Use variable to generate expression
    Pure SQL is not enough to generate my expression, I need cycles, ifs etc.
    4) Use special IKM which replace some substitution symbols with generated expression.
    Well if there is no other choise I'll pick this up but don't want to have additional special KM.
    Could someone propose other solution or workaround for listed?
    Many thanks in advance!
    Oleg Ivanov

    Dev -
    I followed this thread and thought I'll try it in my end. Did the following.
    1)Created a procedure and pasted your code (changed the table name to mine)
    2)Created an interface and connected my source and target. In one of the target columns I put <@=result@>
    3)created a package and brought procedure and interface.
    When I executed the procedure ran successfully but failed at the interface level. I am getting the following error message.
    17008 : null : java.sql.SQLException: Closed Connection
    java.sql.SQLException: Closed Connection
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
         at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:753)
         at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:670)
         at com.sunopsis.sql.SnpsQuery.a(SnpsQuery.java)
         at com.sunopsis.sql.SnpsQuery.a(SnpsQuery.java)
         at com.sunopsis.sql.SnpsQuery.updateExecStatement(SnpsQuery.java)
         at com.sunopsis.sql.SnpsQuery.executeQuery(SnpsQuery.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.j(e.java)
         at com.sunopsis.dwg.cmd.h.z(h.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)

  • Regular expression evaluation with logical operator

    Hi All,
    I am bit confuse with expression evaluation with logical operator. I am trying to understand below expression.
    eXa.getTrue() && eXa.getFalse() || eXa.getFalse() && eXa.getTrue() || eXa.getFalse() comes as false and True Count: 1 False Count: 3
    As per understanding it should be true with True Count: 1 False Count: 3
    it should execute 1st getTrue() and then 1stGetFalse() and then 2nd getfalse() and should skip 2nd getTrue() and execute 3rd fetFalse()
    eXa.getTrue() && eXa.getTrue() || eXa.getFalse() && eXa.getTrue() || eXa.getFalse() comes as true and True Count: 2 False Count: 0
    As per understanding it should be true with True Count: 3 False Count: 0
    it should execute 1st 2 getTrue() and skip 1st getFalse() and then execute 3rd getTrue() and skip last getFalse().
    eXa.getTrue() || eXa.getFalse() && eXa.getFalse() || eXa.getTrue() && eXa.getFalse() comes as true and True Count: 1 False Count: 0
    As per understanding it should be true with True Count: 2 False Count: 2
    it should execute 1st getTrue() and skip 1st getFalse() and then execute 2nd getFalse() and then execute 2nd getTrue() and then 3rd getFalse()
    Please help me to understand above expressions.
    Here is the methods definition:
    private boolean getTrue() {
              trueCount++;
              boolean retrunValue = 4 > 3;
              return retrunValue;
    private boolean getFalse() {
              falseCount++;
              boolean retrunValue = 3 > 4;
              return retrunValue;
    Thanks for ur help

    >
    adding parenthesis to make order of ops more obvious. adding "?" to show un-executed calls.
    (eXa.getTrue() && eXa.getFalse()) || (eXa.getFalse() && eXa.getTrue()) || eXa.getFalse()  comes as false and True Count: 1 False Count: 3
    (T && F) = F
    (F && ?) = F
    (F) = F
    F || F || F = F
    (eXa.getTrue() && eXa.getTrue()) || (eXa.getFalse() && eXa.getTrue()) || eXa.getFalse()  comes as true and True Count: 2 False Count: 0
    (T && T) = T
    (? && ?) = ?
    (?) = ?
    T || ? || ? = T
    eXa.getTrue() || (eXa.getFalse() && eXa.getFalse()) || (eXa.getTrue() && eXa.getFalse())  comes as true and True Count: 1 False Count: 0
    (T) = T
    (? && ?) = ?
    (? && ?) = ?
    T || ? || ? = T

  • Dynamic Expression

    Hello, My name is Alejandro Arango
    My problem is that i want to make expression dynamic, with that i mean the following:
    I want to be able to change an expression in a assign Statement from concat("var1") to concat("var2") and the expression is obtained from a service so the message in the assign can be changed dynamically without having to recompile and redeploy the BPEL process. The idea is to separte the message template from the bpel process.
    Thx BPEL Team

    Hey Clemens thanks for the reply and also i hope you had an esplendid vacation on Croatia. Back to the topic.
    The need for Dynamic Expression is due for many factors
    - Bug or a Behavior in Oracle BPEL Designer (JDeveloper) that constantly reformat the bpel process file so it always clears the line feeds and carrier returns making almost imposible to mantain the messages inside the bpel process (messages for notification pourposes).
    - Separate the message template from the process, so the message can be updated without having to compile again the bpel proceess for the simple reason to change a simple word in the message (Like Apache Velocity, where u have a template for creating dynamic messages)
    I know that this is more like a feature request rather than a simple or need bug fix.
    Also i want to know if it is possible to implement a java class that can obtain the bpel process variables outside the scope of the java:exec part. Look the example for more clarification:
    XYZprocess.bpel
    <process name="XYZprocess"
    <bpelx:exec name="getVariableData" language="Java" version="1.4">
    <![CDATA[
    // This will create a string based on the template given in the file
    String data = Template.generateMessageFromFile("template.txt", this);
    ]]>
    <process/>
    Template.java
    Class Template
    public static String generateMessageFromFile(String file, BPELXExecLet process)
    Element element1 = (Element) process.getVariableData("var1");
    Element element2 = (Element) process.getVariableData("var2");
    return element1.toString() + element2.toString() ;
    The idea is to fill the element1 and element2 variable with the variable of the bpel process. One dificult is that the class of the bpel process (BPELXExecLet) all the API methods are porotected so it can be only executed inside the bpelx:exec tag and not outside of this scope.
    Thanks You.

  • Dynamic expression evaluater

    I have a dynamic expression of this sort:
    { (( A || B ) && ( C || D )) || E }
    where A,B,C,D,E...(and so on) are boolean variables and the operators between them keep changing.
    How can i do this through some methods?

    If the expression is valid java syntax, then consider writing a piece of code that writes a piece of java with a method containing your expression, and where the letters in the expressions are local variables.
    Then invoke the compiler on the generated code using Runtime.exec, load the class and use it.
    How fast is this process you might ask? The slowest I have seen was one and a half second on a 550 MHz PIII W2K PC, the fastest was down around 0.01 second, on a recent Athlon with SCSI disks and Linux.
    Of course as soon as the class is loaded it is a method call like any other one, so if you want to invoke the expression many times with different values the runtime cost is only the cost of as many method calls, you don't have to regenerate the java again until you change the expression.
    You can trade simplicity of implementation for load time speed by generating the class file directly without using java source code as an interim format. O'Reilly has a book on how to write "assembler" for the JVM that explains how to do this. You won't be touching the disk system at all, but will be writing the bytes of a class definition directly to the ClassLoader.defineClass method

  • [svn] 2384: The ASC fix for ASC-3414 resulted in a correction of the behavior of E4X filter expression evaluations , but we don't want to introduce this change in a Flex 3.0.x minor release.

    Revision: 2384
    Author: [email protected]
    Date: 2008-07-08 06:23:19 -0700 (Tue, 08 Jul 2008)
    Log Message:
    The ASC fix for ASC-3414 resulted in a correction of the behavior of E4X filter expression evaluations, but we don't want to introduce this change in a Flex 3.0.x minor release. So I'm reverting this fix from the 3.0.x branch of ASC and checking in a new 1.4 downgraded asc.jar to reflect the change. This will be merged to other Flex 3 branches such as 3.0.3 and 3.1.0, but will not be merged to trunk.
    The change in behavior was noticed for Flex 3.0.x when a asc.jar was updated in revision 2108, and re-applied in revision 2129. Reverting this fix will resolve bug SDK-15924.
    QE: Yes
    Doc: No
    Checkintests: Pass
    Reviewer: Erik
    Bugs:
    SDK-15924 - Calling a .NET WebService always returns a fault (after build 2108)
    Other Bugs Referenced:
    ASC-3414 - with block uses local variable instead of object property when -warnings flag on
    Ticket Links:
    http://bugs.adobe.com/jira/browse/ASC-3414
    http://bugs.adobe.com/jira/browse/SDK-15924
    http://bugs.adobe.com/jira/browse/SDK-15924
    http://bugs.adobe.com/jira/browse/ASC-3414
    Modified Paths:
    flex/sdk/branches/3.1.0/lib/asc.jar
    flex/sdk/branches/3.1.0/modules/asc/src/java/macromedia/asc/embedding/LintEvaluator.java

    Yes but there's no point doing it here. As the Terms of Use make quite clear this is a User to User forum. It's Users like you talking to other Users. It's not a channel to communicate with Apple.
    Regards
    TD

  • [svn] 2383: The ASC fix for ASC-3414 resulted in a correction of the behavior of E4X filter expression evaluations , but we don't want to introduce this change in a Flex 3.0.x minor release.

    Revision: 2383
    Author: [email protected]
    Date: 2008-07-08 06:22:40 -0700 (Tue, 08 Jul 2008)
    Log Message:
    The ASC fix for ASC-3414 resulted in a correction of the behavior of E4X filter expression evaluations, but we don't want to introduce this change in a Flex 3.0.x minor release. So I'm reverting this fix from the 3.0.x branch of ASC and checking in a new 1.4 downgraded asc.jar to reflect the change. This will be merged to other Flex 3 branches such as 3.0.3 and 3.1.0, but will not be merged to trunk.
    The change in behavior was noticed for Flex 3.0.x when a asc.jar was updated in revision 2108, and re-applied in revision 2129. Reverting this fix will resolve bug SDK-15924.
    QE: Yes
    Doc: No
    Checkintests: Pass
    Reviewer: Erik
    Bugs:
    SDK-15924 - Calling a .NET WebService always returns a fault (after build 2108)
    Other Bugs Referenced:
    ASC-3414 - with block uses local variable instead of object property when -warnings flag on
    Ticket Links:
    http://bugs.adobe.com/jira/browse/ASC-3414
    http://bugs.adobe.com/jira/browse/SDK-15924
    http://bugs.adobe.com/jira/browse/SDK-15924
    http://bugs.adobe.com/jira/browse/ASC-3414
    Modified Paths:
    flex/sdk/branches/3.0.3/lib/asc.jar
    flex/sdk/branches/3.0.3/modules/asc/src/java/macromedia/asc/embedding/LintEvaluator.java

    Yes but there's no point doing it here. As the Terms of Use make quite clear this is a User to User forum. It's Users like you talking to other Users. It's not a channel to communicate with Apple.
    Regards
    TD

  • [svn] 2377: The ASC fix for ASC-3414 resulted in a correction of the behavior of E4X filter expression evaluations , but we don't want to introduce this change in a Flex 3.0.x minor release.

    Revision: 2377
    Author: [email protected]
    Date: 2008-07-07 14:38:01 -0700 (Mon, 07 Jul 2008)
    Log Message:
    The ASC fix for ASC-3414 resulted in a correction of the behavior of E4X filter expression evaluations, but we don't want to introduce this change in a Flex 3.0.x minor release. So I'm reverting this fix from the 3.0.x branch of ASC and checking in a new 1.4 downgraded asc.jar to reflect the change. This will be merged to other Flex 3 branches such as 3.0.3 and 3.1.0, but will not be merged to trunk.
    The change in behavior was noticed for Flex 3.0.x when a asc.jar was updated in revision 2108, and re-applied in revision 2129. Reverting this fix will resolve bug SDK-15924.
    QE: Yes
    Doc: No
    Checkintests: Pass
    Reviewer: Erik
    Bugs:
    SDK-15924 - Calling a .NET WebService always returns a fault (after build 2108)
    Other Bugs Referenced:
    ASC-3414 - with block uses local variable instead of object property when -warnings flag on
    Ticket Links:
    http://bugs.adobe.com/jira/browse/ASC-3414
    http://bugs.adobe.com/jira/browse/SDK-15924
    http://bugs.adobe.com/jira/browse/SDK-15924
    http://bugs.adobe.com/jira/browse/ASC-3414
    Modified Paths:
    flex/sdk/branches/3.0.x/lib/asc.jar
    flex/sdk/branches/3.0.x/modules/asc/src/java/macromedia/asc/embedding/LintEvaluator.java

    Yes but there's no point doing it here. As the Terms of Use make quite clear this is a User to User forum. It's Users like you talking to other Users. It's not a channel to communicate with Apple.
    Regards
    TD

  • Simple expression evaluator

    Hi all,
    need some help with an expression evaluation:
    user inputs a string like "x*x+dx*dy" or "x*dx-y*dy" and I
    would like Flash to covert this to an actionscriptline so in the
    code it appears like:
    x=3;
    dx=0.6;
    dy=0.1;
    aa=x*x+dx*dy;
    trace(aa);
    and the output would be: 9.06
    Now my problem is converting the operator.
    Anybody for a solution for this newbie?
    thnx
    Rob

    Ok, so I think my advice stands then...
    You could write your own expression parser, using eval("x")
    when you came to parse an x in the string etc...and its probably
    not too complicated to do if you're just dealing with
    multiplication and addition.... or you could use existing code like
    the example in the link I posted earlier to parse the expression
    (I've used that code before for something more complex).
    If you were writing your own parser you could use eval("x")
    ...but if it were me... I would do the opposite. That is to split
    and join the string with the variable names, subsitituting their
    values into the string and then run it through that expression
    parser. Its basically just calculating a string version of a
    numeric expression then with no variables.
    For your variable --> value substitution (split and then
    join) you need to do it in the order of the
    dx and dy
    then x and y
    so you get it to work correctly.

  • I am looking for an boolean and numeric expression evaluator. I want to be able to compare ( ,=, , or, not, and, nand, etc)and evaluate boolean/numeric expression.

    I am looking for an boolean and numeric expression evaluator. I want to be able to compare (>,=, <, or, not, and, nand, etc)and evaluate boolean/numeric expression. Does anyone know if there is any code samples anywhere. If anyone has any input, I would greately appreciate it.

    The problem is that I have to enter a string of that type (any random string), and the program should go and calculate the result for the whole stirng, by looking at which parts to calculate first (figuring out precedence), second, etc. This is like a calculator, you don't know what the user is going to enter next, so I can't just use the boolean palatte. I could use it if the equation was always of the form "a 'operator' b", where the operator is any logic or comparison operator. But that is not what I am trying to accomplish.
    Can you do logic in the formula node? I think it only allows numeric values for inputs and outputs, it doesn't let you enter in and output booleans and stuff..does it?
    Thanks,
    Yuliya

  • [svn] 1443: Fix FB-12505: Debugger expression evaluator: Literal operators return internal error

    Revision: 1443
    Author: [email protected]
    Date: 2008-04-28 15:09:20 -0700 (Mon, 28 Apr 2008)
    Log Message:
    Fix FB-12505: Debugger expression evaluator: Literal operators return internal error
    Ticket Links:
    http://bugs.adobe.com/jira/browse/FB-12505
    Modified Paths:
    flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/expression/DebuggerExpressi on.java

Maybe you are looking for