Syntax for using a variable in an equation.

Hi all,
Simple question here.  What is tha appropriate syntax for using a variable in a calculation equation.  Specifically, I am taking an established curve fitting equation from my channels and trying to calculate it over a lineargenerated data set to extend the curve  beyond the original data sample.  Here is the small portion of script I have that will not work.  Thanks for any help.
dim a,b,c
a = Data.Root.ChannelGroups(5).Channels("air consumption formula").Properties("ResultApprAnsatzCoef1").Value
b = Data.Root.ChannelGroups(5).Channels("air consumption formula").Properties("ResultApprAnsatzCoef2").Value
c = Data.Root.ChannelGroups(5).Channels("air consumption formula").Properties("ResultApprAnsatzCoef3").Value
Call Calculate("Ch(""[5]/Air Consumption LG"")= ""a"" + Ch(""[5]/LinearGenerated"")*""b""+""c""*ch(""[5]/LinearGenerated"")^2")

Hi Gloorious,
I am using diadem script.  In my example above, for the equation, if I substitue a,b,and c with numerical values, the script runs just fine and the formula executes as desired.  Is there a way to place the variables there instead as I have tried to do (I was hoping it was just a syntax issue) or do I have to approach it a completely different way?
This script will execute just fine:
Call Calculate("Ch(""[5]/Air Consumption LG"")= 4 + Ch(""[5]/LinearGenerated"")*5+6*ch(""[5]/LinearGenerated"")^2")
but this will not:
dim a,b,c
a = Data.Root.ChannelGroups(5).Channels("air consumption formula").Properties("ResultApprAnsatzCoef1").Value
b = Data.Root.ChannelGroups(5).Channels("air consumption formula").Properties("ResultApprAnsatzCoef2").Value
c = Data.Root.ChannelGroups(5).Channels("air consumption formula").Properties("ResultApprAnsatzCoef3").Value
Call Calculate("Ch(""[5]/Air Consumption LG"")= ""a"" + Ch(""[5]/LinearGenerated"")*""b""+""c""*ch(""[5]/LinearGenerated"")^2")

Similar Messages

  • What is the correct syntax for using a variable in an ad hoc query?

    Hi all
    I am an occasional DB user and at the moment need to update about 1000+ records so that a certain column gets a unique value.
    So I thought that I would use a variable for this.
    I then built this kind of SQL statement for just a small subset of the records:
    variable recNumber number;
    exec :recNumber := 1;
    UPDATE TABLE_TO_BE_UPD
    SET COL_TO_BE_UPD = COL_TO_BE_UPD + recNumber
    WHERE COL_TO_BE_UPD IN ('VAL_A','VAL_B');
    I get the invalid SQL statement error when attempting to execute above (besides the prompt that asks for a value which I would like to omit).
    Anyway I also tried this one:
    CREATE SEQUENCE seqCounter;
    UPDATE TABLE_TO_BE_UPD
    SET COL_TO_BE_UPD = COL_TO_BE_UPD + seqCounter.NEXTVAL
    WHERE COL_TO_BE_UPD IN ('VAL_A','VAL_B');
    From this one I got the error ORA-01722: invalid number...I am guessing this comes because seqCounter is of type number and the COL_TO_BE_UPD is of type character...(?)
    So what I would like to ask is what is the correct way to define and use a counter type of variable to append a number at the end of a character string?
    Also another question that I would like to ask is that are variables that are used in ad hoc queries also called 'bind variables'?
    Thanks muchly

    If you want to append a unique number to a column then this would do it:
    UPDATE TABLE_TO_BE_UPD
    SET COL_TO_BE_UPD = COL_TO_BE_UPD ||to_char(rownum)
    WHERE COL_TO_BE_UPD IN ('VAL_A','VAL_B');

  • Syntax for declaring global variable in report

    Hello all,
    Kindly let me know syntax for declaring global variable in report?
    Thnks,
    SUnny

    Hi Sunny,
    All data declaration in the main program is global.
    Only if you do some data declaration withtin the subroutines then the scope of the variable is limited to that FORM ....ENDFORM.
    As you read in the above reply for a global variable in FM you need to declare in the top include.
    This means that you want this variable to be made available to all the Function Modules in that Function Group.
    If you want to make the variabe be available only within that FM then do the declaration in the source code itself.
    hope this explaination helps,
    Taher.

  • Syntax for defining a variable  with size in changing parameters

    hi,
    syntax for defining a variable  with size in changing parameters in the form statement.

    Hi prasad,
    1. one option is to type it as an data element.
    eg.
    form abc changing myvar type char10.
    endform.
    where char10 is a data element with length 10 characters.
    regards,
    amit m.

  • Syntax for using AND with a variable in Business Rule Source

    I've never fully gotten my head around the AND/OR syntax of calc scripts. What I'd like to do is as follows in some basic pseudo code:
    FIX( ("A97" AND [Selected_Entity]) OR ("B76" AND [Selected_Entity]) OR ("C63" AND [Selected_Entity]) ).
    I want my webform's business rule to execute on the selected Entity in the form (eg. A97) ONLY if that entity is part of a restricted list of members (in this case, 3 entities out of 200).
    Thanks for any advice!

    Hi,
    I am not sure if I have totally understood what you are trying to achieve so sorry if I have misread it.
    But what you could do is set up a variable in the Bus Rule, lets call EntVar.
    It is set up as a local variable of type member and dimension Entity with a run time prompt "Enter Entity"
    Now in your script it could look something like this....
    FIX(&CurrentYr, "Working".......)
    "AccMember"(
    IF(@ISMBR([EntVar]) AND ([EntVar]=="A97" OR [EntVar]=="B76" OR [EntVar]=="C63") )
    AccMember=.......;
    ENDIF
    ENDFIX
    Once you have tested the business rule, you can get your form to pass through the entity into the variable.
    Is this what you are trying to do?
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • What is proper syntax for using PassBack in a Report page select statement

    In my select statement I reference the passBack function using:
    onClick="javascript:passBack()"
    In my Page Header I (Typically) define the passBack function as:
    <script language="JavaScript" type="text/javascript">
    function passBack(passVal1,passVal2) {
    opener.document.getElementById("P2000_CABLE_ID").value = passVal1;
    opener.document.getElementById("P2000_CABLE_LABEL").value = passVal2;
    window.opener.location.reload(true);
    </script>
    But I have never used the passBack function from the Select statement before and cannot happen onto the proper syntax.
    The Page Items I want to pass are:
    1. :P2004_CABLE_ID
    2. :P2004_LABEL
    I want to pass them to:
    1. :P2000_CABLE_ID
    2. :P2000_CABLE_LABEL
    Can someone please help me out... Again?
    Thanks- Gary

    Let's assume column XYZ has both numbers (1), and letters (any alphabet).
    I have a case statement on SQL to turn any value that's not 1 into 0, then I am getting a sum of that column.
    I am also grouping by Row A, B etc to get aggregated sum of column XYZ for those group.
    Now on Crystal Reports function, I need to sum up values under column XYZ for all the groups.
    If I try using sum function like below, I get an error stating:
    "A number field or currency amount field is required here"
    (sum({Command.XYZ}))
    So I thought if I can use a case statement to change the non-numbers to 0 prior to sum that will probably resolve it. But I could not get the below case statement to work either (Error: A string is required). 
    SELECT {Command.XYZ}
       Case 1:
          1 
       Default:
          0;

  • Syntax for calling on variable movie slip within its parent

    I know my syntax is wrong based on the error I am getting, but I can't figure out any other way to do this:
    Code:
    var menuButtons:Array=["home","liveIntense","liveAblaze","liveBright","liveClean","about","co ntact","shirts","soaps","stickers","blog"];
    for (var i:uint=0; i<menuButtons.length; i++) {
              addButtonListeners(menuButtons[i],menuButtons_mc,clickF);
    function addButtonListeners(buttonName:String,buttonParent:MovieClip,clickFunction:Function):void {
              var button= new buttonParent_mc();
              buttonParent.addChild(button);
              button.x=buttonParent.this[buttonName+"_btn"].x;
              button.y=buttonParent.this[buttonName+"_btn"].y;
              buttonParent.this[buttonName+"_btn"].visible=false;
    Output:
    1084: Syntax error: expecting identifier before this.
    I know the issue is here: buttonParent.this[buttonName+"_btn"].x
    how can I call on moveiclips with different names that are within anothe movie clip?
    Thanks!

    use:
    var menuButtons:Array=["home","liveIntense","liveAblaze","liveBright","li veClean","about","contact","shirts","soaps","stickers","blog"];
    for (var i:uint=0; i<menuButtons.length; i++) {
              addButtonListeners(menuButtons[i],menuButtons_mc,clickF);
    function addButtonListeners(buttonName:String,buttonParent:MovieClip,clickFunc tion:Function):void {
              var button= new buttonParent_mc();
              buttonParent.addChild(button);
              button.x=buttonParent[buttonName+"_btn"].x;
              button.y=buttonParent[buttonName+"_btn"].y;
              buttonParent[buttonName+"_btn"].visible=false;

  • Resource needed for using  1 variable in 2 classes

    can anyone point me to a good resource on calling/using variables in another class? the problem i am facing is that i am using a for loop that has the string []splitresult variable used, i want to use this in another class aswell and dont no how,
    i really need a resource, preferably from the java turoials as they are easier to understsnd for me?
    thank you for that

    class MyClassA {
      int myVar = 3;
      public int getMyVar() {
         return this.myVar;
      public int setMyVar( int var ) {
        this.myVar = var;
    class MyClassB {
      public static void main ( String[] args ) {
         MyClassA myClassA = new MyClassA();
         int y = myClassA.getMyVar();
         myClassA.setMyVar( 44 );
         int z = myClassA.getMyVar();
         // if myVar was public you could do this, but this is NOT recommended, unless you have a good reason:
         int x = myClassA.myVar;
    }Edited by: ajmasx on Mar 15, 2008 10:08 AM

  • Syntax for CASE Function when multiple values equates to the same result?

    Tried using the 'IN' keyword with the CASE function but it does not work, does each case have to be stated separately? trying to save some lines..
    tried:
    case me607.rmc_code
    when in ('M','MS','MP') then 'H311'
    end as carrier_code
    Do i have to do:
    case me607.rmc_code
    when 'M' then 'H311'
    when 'MS' then 'H311'
    when 'MP' then 'H311'
    end as carrier_code,
    etc..
    Thanks for any help..

    One other thing forgot to ask, how do you do a second case selection as:
    case when me607.rmc_code
    in ('M','MP','MS') then 'H311'
    case when me607.rmc_code
    in ('1','2') then 'H252'
    end as carrier code
    wanting to keep the results in carrier_code..
    Thanks..
    Edited by: user12296489 on Dec 10, 2009 3:53 PM

  • PLACEHOLDER Syntax for multiple Input Variables

    Hi,
    I am trying to pass multiple paramter values (not multi-value) it works when the first parameter is passed but does not work when I add the second parameter value. I need to pass 4 different paramters and the statement is below..
    The placeholder sysntax works with hard coded values or only one PARAMETER is passed.... as below...(For clarity I aligned the placeholder syntax....
    FROM "_SYS_BIC"."ZXXXXXX/ZSTAR_OT"
    ('PLACEHOLDER' = ('$$IP_TOMNTH$$', '201302'),
    'PLACEHOLDER' = ('$$IP_FRMNTH$$', '201301'),
    'PLACEHOLDER' = ('$$IP_KOSTL$$', '3001D,3004D'),
    'PLACEHOLDER' = ('$$IP_BUKRS$$', '1000'))
    It works as below. (when one of placeholder is provided a @Prompt as below
    FROM "_SYS_BIC"."ZXXXXXX/ZSTAR_OT" ('PLACEHOLDER' = ('$$IP_TOMNTH$$', @Prompt(P_TOMNTH)), 'PLACEHOLDER' = ('$$IP_FRMNTH$$', '201301'), 'PLACEHOLDER' = ('$$IP_KOSTL$$', '3001D,3004D'), 'PLACEHOLDER' = ('$$IP_BUKRS$$', '1000')))
    when I add the second parameter I get an error
    FROM "_SYS_BIC"."ZXXXXXX/ZSTAR_OT" ('PLACEHOLDER' = ('$$IP_TOMNTH$$', @Prompt(P_TOMNTH)), 'PLACEHOLDER' = ('$$IP_FRMNTH$$', @Prompt(P_FRMNTH)), 'PLACEHOLDER' = ('$$IP_KOSTL$$', '3001D,3004D'), 'PLACEHOLDER' = ('$$IP_BUKRS$$', @Prompt(P_COMP_CODE)))
    the error is
    Substitution failed: No value supplied for Parameter "P_FRMNTH". (QTJ 00520)
    Any idea why this is happening.....
    Thank you,
    Arthur.

    I found an issue and fixed it. It is a simple fix within Data Foundation where the paremeters are defined, just change the Parameter text to be different and it validates fine.
    Thank you for all those who viewd this post and try to help you.
    Arthur.

  • Using Shared Variables and Initialize Front Panel Binding (to PSP)

    Hi,
    I use LV DSC RT 8.2.1
    I have a Vacuum System That includes signals from - Pumps failure, Valves status, Vacuum gauge, start Pump ...
    Each signal is read by a FieldPoint. 
    All the relevant FieldPoint Channels are read by the Server (a computer in the Ethernet Network) and published to the network in the form of Shared Variables.
    I have a client VI that is reading the Shared Variables published by the Server using Front Panel Binding.
    Problem : 
    Some of the Bindings are in the mode 'Write &Read' and that causes some initialization problems.
    For example - Valve #1 is Open, and then a User start running the Client VI, (the Valve #1 Status mode is 'Write & Read")
                           if in the VI the status of Valve #1 is closed (before running it) then the Valve status is changing to Closed.
    I want the Client VI to first read the Physical status of the instrument and then to change the Value if the User changes it.
    But that's seems to be a problem when using Front Panel Binding... (is it?)
    I know I can Deploy a lvlib in the Client Side and Item Bind to the Shared Variables or Use DataSocket.
    (Is DataSocket is a Reliable method when connecting to Shared Variables? What are the disadvantages when using DataSocket?) 
    What is recommended by those of you that are experienced or by NI ?
    Sincerely Yours,
    Amitai Abramson.

    Amitai Abramson,
    Hello and thanks for using the NI Forums.
    I'm glad that you've read the Using the LabVIEW Shared Variable Tutorial on our website. Check out these other resources:
    Network Variable Technical Overview
    Troubleshooting Network-Published Shared Variables
    Why Do I See Unexpected Value Change Events for Shared Variables Using LabVIEW DSC?
    All You Need to Know About Shared Variables
    Creating a Value Change Event for Shared Variables
    Alternative Method for Using Shared Variables Between Systems in LabVIEW 8.x
    What Is The Difference Between Using Shared Variables And DataSocket VIs To Access OPC Tags?
    The issue that you are seeing by having "Write & Read" bound items on both the server and client side is essentially a race condition, you don't know which one is being read/written at what time. To resolve this issue I would take a look at some of the documents below.
    Using a Local, Global, or Shared Variable in Parallel Loops Can Cause Race Conditions
    Using Local and Global Variables Carefully
    Tutorial: Local Variable, Global Variable, and Race Conditions
    Locking a Shared Resource or Variable in LabVIEW Using Semaphores
    You mentioned not wanting to have two sets of shared variables (one on each side), but this is a great method to resovle this issue, that, or you can develope some sort of hand shaking to prevent these race conditions.
    I would suggest that in the future when using these forums you try to ask only one question per thread and make it more concise. It's hard to tackle multiple questions and such broad questions as "I want to know all the ways that I can connect to Shared Variables, and I want to know the advantages and disadvantages." I suggest this because we want you to get your questions answered and more concise questions will result in quicker and better answers. 
    Message Edited by Ben S on 10-01-2009 06:05 PM
    Ben Sisney
    FlexRIO V&V Engineer
    National Instruments

  • Syntax errors using sql and java

    Could somebody inform of the correct syntax for using UPDATE and INSERT SQL commands in a java program? Any information I can find demonstrates this with:
    INSERT INTO table_name(column_name, ..., column_name)
    VALUES(value, ..., value)
    However - this isn't working? any suggestions - and I know its very basic, but I'm just learning.
    String query = " INSERT INTO SESSIONS (" +                                   
                        "id,module_name, module_number, level, session " +
                        "term, class_list, location, lecturer" + ")
    VALUES('"+
                        fields.id.getText() + "', '"+
                        fields.module_name.getText() + "', '" + fields.module_number.getText() + "', '" +
                   fields.level.getText() + "', '" fields.session.getText() "', '" +
                   fields.term.getText() + "', '" fields.class_list.getText() "', '" +
                   fields.location.getText() + "', '" fields.lecturer.getText() "')";
              output.append( " \nSending query: " + connection.nativeSQL(query)+ "\n");                                                                                                         
              output.append( "query sent");     
    thanks
              int result = statement.executeUpdate(query);                    

    With all those quotes and apostrophes and string concatenations, I'd be surprised if you got it right by the fourth try. (By the way, you appear to have missed a comma between "session" and "term".) Are you planning to insert more than one record in your program? If so, you should consider using a PreparedStatement. This will likely run faster, and your program will definitely be easier to read. Also, you won't have to come back here later to ask how you deal with data that includes apostrophes (the notorious "O'Brien" problem). Here's how you do that... you define the PreparedStatement only once:
    String query =
      "INSERT INTO SESSIONS (id,module_name, module_number, level, session, term, class_list, location, lecturer) " +
      "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)";
    PreparedStatement insert = connection.prepareStatement(query);and then every time you want to insert a record you do this:
    insert.setString(1, fields.id.getText());
    insert.setString(2, fields.module_name.getText());
    // and so on...
    insert.executeQuery();

  • Possible to use local variables in Calculation Manager

    Hi,
    I'm using calculation manager in EPMA for the first time. Have not found any function for using "local variables", i.e. variables that can be used for fixing on the current members a user has selected in a form. Do someone know if it is possible to use that functionality in calculation manager? And in that case, how do I find it?
    Thanks!
    Regards
    Mats

    Hi,
    I guess you are referring to local variables in Essbase Administration Console. When you are in calculation manager (System View), you can go to Tools->Variables. There you can create variables at application, database (global) or business rule level (local variable). You can use these in Business rules by placing the name in curly bracket {...}.
    The usage of the variables in the forms is the same as before.
    If however, what you meant to say by local variables is substitution variables, yes you can use them in Calc manager the same way you use in calc script.
    Cheers,
    Alp

  • 'How to..use reporting variables in BPS'  syntax issue

    Hi,
    I am implementing the white paper 'How to...use reporting variables in BW-BPS' and I am getting a syntax error in the include YBW_BPS_VAR_READ. The error indicates 'Statement is not accessible' for my line:
    SELECT SINGLE * FROM ybw_bps_var_map
    ybw_bps_var_map being my transparent table as described in the white paper.
    I have never seen such a syntax error, has anyone had the same issue? My code is the one in the white paper.
    Thanks for any help.
    David

    Hi David,
    I have the coding up and running. I have not seen this error before and don't know how to resolve it. If you cut&paste it from the PDF, then maybe some special characters got pasted into the ABAP editor. Try to delete the line and type it in manually.
    Regards
    Marc
    SAP NetWeaver RIG

  • What is the proper SQL syntax for dates input as variable

    Hello,
    I am working on an ASP JavaScript page that requests totals
    from an Access database for a specific date range. I can write the
    SQL statement to query the DB and get the results I need using the
    WHERE statement below.
    ...WHERE LABOR_DATE BETWEEN #7/15/2006# AND #7/18/2006# GROUP
    BY [LABOR].[JOB_NUMBER_NAME]
    I have another page that I want to pass two variables in
    Dreamweaver specifying the date range varBeginDate and varEndDate
    and query the database using the date range input by the user.
    What is the correct syntax for replacing the actual dates in
    the example above with my variable values?

    Short answer - you can't. There's no automatic link between file paths and mounting servers. There are lots of valid reasons for this (e.g. preventing malicious links from automatically opening files from remote servers), but you can get there in a controlled environment.
    You can configure Automounts on any directory. That way whenever any application tries to access a particular path the OS will automatically mount the directory, but it needs to be told in advance which directories (and which servers) to mount.
    For example, if you'd configured your iTunes Library to be saved at /mnt/itunes and it's served from afp://mediaserver.your.net/path/to/itunes you would configure an automount to mount the AFP server at /mnt/itunes.
    Since its an automount, the OS wouldn't mount the server until some process tried to read /mnt/itunes.
    There are several ways of specifying automounts, and for each there are several tutorials online that walk you through the process. Try Mike Bombich's site for a starter.

Maybe you are looking for

  • BPM and ESB

    Please tell the difference between BPM and ESB.

  • Just applied July 2010 CPU to 11.5.10 CU2 - passwords need to be reset?

    I just released my July 2010 CPU patched environment back to the user community and the first issue I had was the tester telling me his password didn't work. Same thing for another tester. I was able to login as 'sysadmin' and change reset his passwo

  • "tap to click" resetting after shut down/restart

    I've been having trouble more and more frequently with the "tap to click" option - sometimes when I turn my (2.5 year old) MacBook off at night and restart it the next morning, tap to click will be unchecked and I will have to go reset it in System P

  • I realy want to remove IMVUinc from my computer and you include it how can I get rid of it????

    I don't want IMVU as a search option I don't want it as a home pagew I don't want any trace of it on my computer and now from Firefox I have it please help me to remove all traces of it from my computer so I don't have to remove firefox to do it...

  • Interbase/Firebird stored proc questions

    I have several questions about Interbase/Firebird and the use of stored procedures with JDBC. I am using the FirebirdSQL driver but answers using other drivers (as noted) might be useful as well. 1. Is there any way to call a stored procedure which r