Basic if statement in formcalc..

I'm trying to create basic if statement for one of the fields. I'd like to know your opinion what is wrong with it
//code
form1.#subform[0].Body.TotalTaken[0]::calculate -  (FormCalc, client)
var sum = Sum(Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)
// if I leave only Sum(Jan,...) in this field it works fine, shows the sum...
if (this.rawValue > 0 && TotalAvailable.rawValue <= sum)
  this.rawValue = sum
else
    this.rawValue = 1
endif
//endofcode
Im trying to do basic validation, if sum is between 0 and Total Available number then its ok, display the sum, other wise dosplay some popup, at the moment I want only "1" to be shown since I cant pass even that basic scripts.
I get an error "near token &". It doesnt matter if I switch "this" with field name, "TotalAvailable". All fields are numeric of same type.
Please advice.

Sum() works fine, Jan, Feb etc are names of NumericFields.
I have holidays chart where user puts overall number of days available for him as free from work in field named "TotalAvailable"
in fields named after each month, Jan, Feb etc.. user puts how many days he will use for holidays in given month
In "TotalTaken" field I add all the days user took in any of given months.
With that if statement I want to check if Sum(..) is not bigger than TotalAvailable number, if is bigger then error (or just "1" for now as I have to much troubles with simpler tasks)
Ill try to use your tips and see what comes of it, thank you. Still any advice will be helpfull.
Best regards

Similar Messages

  • Basic import statement

    I have a question whenever I want to print out any string, value, I always use
    System.out.println("some string");
    System.out.print("some string");
    System.out.printf("%s", "some string");my question is: is there anyway that I can write shorter code?
    .out.println("hihi") or just .println("hihi"); I think there must be something to do with the import statement, but just I cant get it to work.

    DO NOT do this. Your laziness will result in unreadble code for others. Anyone who looks at your code will know what System.out.println() means. Whereas they do not know what someObscureMethodName() is or does.

  • Basic SQL statement , Finding Repeated Values

    Hi guys, I have a table with columns
    user_id (varchar2) and mobileno(varchar2).
    A user may have more then 1 mobile number.
    How do i my sql statement such that i can..
    1) see each and every exact mobile number of a particular user without repeating the user_id everytime a row is shown.
    2) see the AMOUNT of mobile number own by a particular user ?
    3) see the AMOUNT of mobile number own by every user in the table?
    Thanks Pals! this forum really has the fastest respond rate.

    Hi,
    About getting only one row per user what you need is to build a function that will return you the numbers concatenated.
    About the other thing you want maybe you can do something like this:
    select distinct
    tab.name,
    count(tab.cell_num) over (partition by tab.name) cell_per_user,
    count(tab.cell_num) over () total_cells
    from
    select 'A' as name,1111 as cell_num from dual
    union
    select 'A',2222 from dual
    union
    select 'B',3333 from dual) Tab

  • Basic Battery State Info - iPhone

    Ive been looking (unsuccessfully) for basic power info exposed by the API. Not looking for anything like advanced power management (ala full blown IOKit) just simple readonly values for approx percentage battery remaining and if device is plugged in (on AC/DC) or not.
    Any ideas?
    In the event that such a thing does not exist (in actuality or via "published" APIs) and Apple Dev is monitoring this forum - Please, please, please give us basic power info.
    We're wanting to be "good citizens" regarding power usage. Being able to selectivly scale back usage and use alt methods at different power levels is very important to deliver on that.
    Something like (BOOL)[UIDevice currentDevice].isPluggedIn and (Float32)[UIDevice currentDevice].powerRemaining would open up a lot of doors for conditional power friendly apps.

    have u posted this interesting feature request to bug reporter ?
    it is probably the best place to do it

  • HOW TO: Post a SQL statement tuning request - template posting

    This post is not a question, but similar to Rob van Wijk's "When your query takes too long ..." post should help to improve the quality of the requests for SQL statement tuning here on OTN.
    On the OTN forum very often tuning requests about single SQL statements are posted, but the information provided is rather limited, and therefore it's not that simple to provide a meaningful advice. Instead of writing the same requests for additional information over and over again I thought I put together a post that describes how a "useful" post for such a request should look like and what information it should cover.
    I've also prepared very detailed step-by-step instructions how to obtain that information on my blog, which can be used to easily gather the required information. It also covers again the details how to post the information properly here, in particular how to use the \ tag to preserve formatting and get a fixed font output:
    http://oracle-randolf.blogspot.com/2009/02/basic-sql-statement-performance.html
    So again: This post here describes how a "useful" post should look like and what information it ideally covers. The blog post explains in detail how to obtain that information.
    In the future, rather than requesting the same additional information and explaining how to obtain it, I'll simply refer to this HOW TO post and the corresponding blog post which describes in detail how to get that information.
    *Very important:*
    Use the \ tag to enclose any output that should have its formatting preserved as shown below.
    So if you want to use fixed font formatting that preserves the spaces etc., do the following:
    \   This preserves formatting
    \And it will look like this:
       This preserves formatting
       . . .Your post should cover the following information:
    1. The SQL and a short description of its purpose
    2. The version of your database with 4-digits (e.g. 10.2.0.4)
    3. Optimizer related parameters
    4. The TIMING and AUTOTRACE output
    5. The EXPLAIN PLAN output
    6. The TKPROF output snippet that corresponds to your statement
    7. If you're on 10g or later, the DBMS_XPLAN.DISPLAY_CURSOR output
    The above mentioned blog post describes in detail how to obtain that information.
    Your post should have a meaningful subject, e.g. "SQL statement tuning request", and the message body should look similar to the following:
    *-- Start of template body --*
    The following SQL statement has been identified to perform poorly. It currently takes up to 10 seconds to execute, but it's supposed to take a second at most.
    This is the statement:
    select
    from
             t_demo
    where
             type = 'VIEW'
    order by
             id;It should return data from a table in a specific order.
    The version of the database is 11.1.0.7.
    These are the parameters relevant to the optimizer:
    SQL>
    SQL> show parameter optimizer
    NAME                                 TYPE        VALUE
    optimizer_capture_sql_plan_baselines boolean     FALSE
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      11.1.0.7
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     100
    optimizer_mode                       string      ALL_ROWS
    optimizer_secure_view_merging        boolean     TRUE
    optimizer_use_invisible_indexes      boolean     FALSE
    optimizer_use_pending_statistics     boolean     FALSE
    optimizer_use_sql_plan_baselines     boolean     TRUE
    SQL>
    SQL> show parameter db_file_multi
    NAME                                 TYPE        VALUE
    db_file_multiblock_read_count        integer     8
    SQL>
    SQL> show parameter db_block_size
    NAME                                 TYPE        VALUE
    db_block_size                        integer     8192
    SQL>
    SQL> show parameter cursor_sharing
    NAME                                 TYPE        VALUE
    cursor_sharing                       string      EXACT
    SQL>
    SQL> column sname format a20
    SQL> column pname format a20
    SQL> column pval2 format a20
    SQL>
    SQL> select
      2             sname
      3           , pname
      4           , pval1
      5           , pval2
      6  from
      7           sys.aux_stats$;
    SNAME                PNAME                     PVAL1 PVAL2
    SYSSTATS_INFO        STATUS                          COMPLETED
    SYSSTATS_INFO        DSTART                          01-30-2009 16:25
    SYSSTATS_INFO        DSTOP                           01-30-2009 16:25
    SYSSTATS_INFO        FLAGS                         0
    SYSSTATS_MAIN        CPUSPEEDNW              494,397
    SYSSTATS_MAIN        IOSEEKTIM                    10
    SYSSTATS_MAIN        IOTFRSPEED                 4096
    SYSSTATS_MAIN        SREADTIM
    SYSSTATS_MAIN        MREADTIM
    SYSSTATS_MAIN        CPUSPEED
    SYSSTATS_MAIN        MBRC
    SYSSTATS_MAIN        MAXTHR
    SYSSTATS_MAIN        SLAVETHR
    13 rows selected.Here is the output of EXPLAIN PLAN:
    SQL> explain plan for
      2  -- put your statement here
      3  select
      4             *
      5  from
      6             t_demo
      7  where
      8             type = 'VIEW'
      9  order by
    10             id;
    Explained.
    Elapsed: 00:00:00.01
    SQL>
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 1390505571
    | Id  | Operation                   | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |          |     1 |    60 |     0   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T_DEMO   |     1 |    60 |     0   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | IDX_DEMO |     1 |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("TYPE"='VIEW')
    14 rows selected.Here is the output of SQL*Plus AUTOTRACE including the TIMING information:
    SQL> rem Set the ARRAYSIZE according to your application
    SQL> set autotrace traceonly arraysize 100
    SQL> select
      2             *
      3  from
      4             t_demo
      5  where
      6             type = 'VIEW'
      7  order by
      8             id;
    149938 rows selected.
    Elapsed: 00:00:02.21
    Execution Plan
    Plan hash value: 1390505571
    | Id  | Operation                   | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |          |     1 |    60 |     0   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T_DEMO   |     1 |    60 |     0   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | IDX_DEMO |     1 |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("TYPE"='VIEW')
    Statistics
              0  recursive calls
              0  db block gets
         149101  consistent gets
            800  physical reads
            196  redo size
        1077830  bytes sent via SQL*Net to client
          16905  bytes received via SQL*Net from client
           1501  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
         149938  rows processed
    SQL>
    SQL> disconnect
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing optionsThe TKPROF output for this statement looks like the following:
    TKPROF: Release 11.1.0.7.0 - Production on Mo Feb 23 10:23:08 2009
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Trace file: orcl11_ora_3376_mytrace1.trc
    Sort options: default
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    select
    from
             t_demo
    where
             type = 'VIEW'
    order by
             id
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch     1501      0.53       1.36        800     149101          0      149938
    total     1503      0.53       1.36        800     149101          0      149938
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 88 
    Rows     Row Source Operation
    149938  TABLE ACCESS BY INDEX ROWID T_DEMO (cr=149101 pr=800 pw=0 time=60042 us cost=0 size=60 card=1)
    149938   INDEX RANGE SCAN IDX_DEMO (cr=1881 pr=1 pw=0 time=0 us cost=0 size=0 card=1)(object id 74895)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                    1501        0.00          0.00
      db file sequential read                       800        0.05          0.80
      SQL*Net message from client                  1501        0.00          0.69
    ********************************************************************************The DBMS_XPLAN.DISPLAY_CURSOR output:
    SQL> -- put your statement here
    SQL> -- use the GATHER_PLAN_STATISTICS hint
    SQL> -- if you're not using STATISTICS_LEVEL = ALL
    SQL> select /*+ gather_plan_statistics */
      2  *
      3  from
      4  t_demo
      5  where
      6  type = 'VIEW'
      7  order by
      8  id;
    149938 rows selected.
    Elapsed: 00:00:02.21
    SQL>
    SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
    PLAN_TABLE_OUTPUT
    SQL_ID  d4k5acu783vu8, child number 0
    select   /*+ gather_plan_statistics */          * from          t_demo
    where          type = 'VIEW' order by          id
    Plan hash value: 1390505571
    | Id  | Operation                   | Name     | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |
    |   0 | SELECT STATEMENT            |          |      1 |        |    149K|00:00:00.02 |     149K|   1183 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T_DEMO   |      1 |      1 |    149K|00:00:00.02 |     149K|   1183 |
    |*  2 |   INDEX RANGE SCAN          | IDX_DEMO |      1 |      1 |    149K|00:00:00.02 |    1880 |    383 |
    Predicate Information (identified by operation id):
       2 - access("TYPE"='VIEW')
    20 rows selected.I'm looking forward for suggestions how to improve the performance of this statement.
    *-- End of template body --*
    I'm sure that if you follow these instructions and obtain the information described, post them using a proper formatting (don't forget about the \ tag) you'll receive meaningful advice very soon.
    So, just to make sure you didn't miss this point:Use proper formatting!
    If you think I missed something important in this sample post let me know so that I can improve it.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Alex Nuijten wrote:
    ...you missed the proper formatting of the Autotrace section ;-)Alex,
    can't reproduce, does it still look unformatted? Or are you simply kidding? :-)
    Randolf
    PS: Just noticed that it actually sometimes doesn't show the proper formatting although the code tags are there. Changing to the \ tag helped in this case, but it seems to be odd.
    Edited by: Randolf Geist on Feb 23, 2009 11:28 AM
    Odd behaviour of forum software                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Need help with IF Statement!!!

    I am trying to write an IF statement using FormCalc in LiveCycle. I have cell "tpe" which captures total points. I would like to assign levels based on the number of points achieved. For example, level I = 1001-1985; level II = 851-1000; level III = 551-850; level IV = <551. I want cell "level" to show either I, II, III or IV, based on the points in cell "tpe". How can I do this? I have zero familiarity with FormCalc or scrips in general. Can someone please help me with this? Would appreciate any help!! Thanks!

    This is what it says:
    topmostSubform.Page3.tpe::calculate - (FormCalc, client)
    sum (rrtotal, programtotal, financetotal, leadershiptotal, executivetotal, meetingstotal, filestotal, brotherhoodtotal, conferencetotal, communicationstotal, minutestotal, standardstotal, basileustotal, abtotal, gramtotal, antigramtotal, tamtotal, pgramtotal, partotal, epistotal, torchtotal, hodtotal, phitotal)
    if ($ > 1000 and $ <= 1985)then
    level = "I"
    elseif ($ > 850 and $ <= 1000)then
    level = "II"
    elseif ($ > 550 and $ <= 850)then
    level = "III"
    elseif ($ <= 550)then
    level = "IV"
    else level = ""
    endif

  • Update statement getting ORA-00904 invalid identifier

    I am getting this ORA error when I try to conduct an update statement from a column value in one table to a like-named column in another table.
    For instance, in my select, shown below, this query runs like a champ, returning all of my records
    SELECT
    b.ID,
    b.ZIP, a.ZIP,
    a.NAME,
    a.LOCATION
    FROM TBL_ARCHIVE a
    INNER JOIN TBL_UAT b ON
    a.ID = b.ID
    WHERE
    b.ID > 470000  And b.ID <470100;However, if I try to run an update statement with any of the following, I get this error. It seems so strange to me that I'd get an error using the same columns in the update statement, but would return the desired results effectively from the select statement!
    one version of UPDATE
    UPDATE TBL_ARCHIVE a
    SET a.ZIP = TBL_UAT.ZIP
    WHERE TBL_UAT.ID = a.ID;and another
    UPDATE TBL_ARCHIVE
    SET a.ZIP  =
    (SELECT b.ZIP
    FROM TBL_UAT b
    WHERE b.ID <472500 And b.ID >471000)
    FROM TBL_ARCHIVE a
    WHERE a.ID = b.ID)
    WHERE ID IN
    (SELECT ID
    FROM TBL_UAT b
    WHERE b.ID  <472500 And b.ID >471000
    );^ - this one produces a SQL not properly ended. Error ORA-00933: SQL command not properly ended.
    I'm really unsure though, how what I thought was a fairly basic update statement wouldn't work. I'm using Oracle 11g but through either Toad or SQL Plus. I've gotten these same errors in both.
    Though MS Access runs slow as snails, I can manage to run the update statement successfully with it, a thousand records or so at a time. Problem is, I've got about 300K records needing updating.
    I've looked around for similar problems but haven't found one where someone wasn't either using a reserved word for a column, which I'm not, I don't believe, or a problem that really dealt with this error in the context of an update statement.
    But I'd welcome any enlightenment on this.

    rp0428 wrote:
    UPDATE TBL_ARCHIVE a
    SET a.ZIP = TBL_UAT.ZIP
    WHERE TBL_UAT.ID = a.ID;That isn't a valid query and neither is the other one.
    Please post the actual query you are using and the actual complete error message you are getting (everything about the error that is displayed).^^
    That is NOT a valid query?
    How else would you have an UPDATE statement created to set the value of a column in table A to the value of a (in this case, same named) column in table B?
    And keep them in order to update the records appropriately?
    I'll append the create statements momentarily.
    Thanks!
    CREATE TABLE TBL_UAT
    ( ID NUMBER(6),
    ZIP VARCHAR2(10 BYTE) ) and
    CREATE TABLE TBL_ARCHIVE
    ( ID NUMBER(6) NOT NULL, NAME VARCHAR2(50 BYTE),
    EMAIL VARCHAR2(50 BYTE),
    LOCATION VARCHAR2(50 BYTE),
    DEPARTMENT VARCHAR2(50 BYTE),
    PRIORITY VARCHAR2(50 BYTE),
    APPROVING_MGR_NAME VARCHAR2(50 BYTE),
    TYPE1 VARCHAR2(50 BYTE),
    TYPE2 VARCHAR2(50 BYTE),
    CONTACT_NAME VARCHAR2(50 BYTE),
    CONTACT_PHN_NO VARCHAR2(50 BYTE),
    LOAN_NUM VARCHAR2(50 BYTE),
    REF_ID VARCHAR2(50 BYTE),
    BORROWER_NAME VARCHAR2(50 BYTE),
    ADDRESS VARCHAR2(50 BYTE),
    CITY VARCHAR2(50 BYTE),
    ST VARCHAR2(50 BYTE),
    ZIP VARCHAR2(10 BYTE),
    SALE_DATE DATE,
    COMMENTS VARCHAR2(800 BYTE),
    TIME_REQ DATE,
    ACCTLOC VARCHAR2(50 BYTE),
    OTHER_ACCTLOC VARCHAR2(50 BYTE)) Hope this can be of assistance.
    Thanks, folks!
    Edited by: user515689 on Feb 7, 2012 11:59 AM

  • How do you create array of enums for transitions in a state machine?

    Hello,
    I am trying to build a state machine, but, I am struggling with understanding the methods for determining which state to transition to next.  In other words, I have several states, but, I don't want to go in any particular sequence.  If I have states numbered 1 through 10, I want to be able to go 1-4-2-5-6-2-6-1-10 etc. in no particular order. I want the transition to the next state  (and actions) to be determined by the streaming data, which can be random and require access to any of my 10 states at any time and in any sequence.
    I saw this picture on the "Application Design Patterns: State Machines" white paper, but, it leaves out some important details.  How does one create the structure in BLUE shown in 3C?  When I try to create this array of enums, all of them are the same. I am not able to make a list of different enum values.  In other words, when I type in "2", then, all the values in the array display as "2."
    There is a nice, simple video example of a state machine for dispensing soda for $0.15, however, this state machine moves in a single sequence, from 5 cents, to 10 cents to dispense; it does NOT illustrate how to select a state "out of order."  I need to understand how a state machine can move from "5 cents" state to dispense directly, with the addition of 10 cents to the "5 cents" state.
    Can anyone suggest a really good tutorial on how to make the selector work in a state machine?  I have been reading some of the available material on ni.com, but, I can't find a good detailed explanation of how to do it.  I remain confused. 
    Or, can you just explain how they created the BLUE array in the attached picture?  Maybe I can figure it out from there.
    Thanks,
    Dave
    Solved!
    Go to Solution.
    Attachments:
    next state.jpg ‏75 KB

    Hi Kathryn,
    Yes, this is EXACTLY what I want to accomplish...
    So it would basically run:
    State 1
    Read input
    Determine next state (say 3)
    State 3
    Read input
    Determine next state
    State
    Read input
    Determine next state
    And so on...
    But, I am quite new to programming Labview state machines, and can't figure out how to even start when the sequence of states is random instead of fixed!!! I can do 1,2,3,4, like the vending machine VI example, but,  not 1,3,2,2,2,5,2,1 etc. based on external input.  Is there some simple example case I can study?  I can't believe I am inventing this for the first time.
    "select the state to run" 
    But, HOW do I do this???????   This is exactly the question I am asking...how is this done?  Please see the attached 3-state system....how do I hook this up????  I am totally lost here...can you help me understand how to wire this thing??  In this simpe RED/GREEN/BLUE case, my input is just the number a user would input on the front panel....  Apparently, there are two files necessary... a vi and .ctl???  What  is .ctl?
    Thanks,
    Dave
    Attachments:
    forum nov 12 red green blue.vi ‏7 KB
    forum nov 12 red green blue.ctl ‏5 KB

  • Escape Characters - simulate the setString from Prepared Statements

    I would like to see what the value of setString() is for a given prepared statement call.
    Because of reasons that would take me to long to explain that I cannot use preparedstatements with their parameters - I need a way to execute a query like the following:
    String query = "insert into blahtable (somestring) values (\"asdfds\'\s sdsfdasfd \"\& ...\");
    PreparedStatement stmt = connection.prepareStatement(query);
    I know prepared statements can take care of this, but I want to know and write the query as above without the need of prepared statements help for string.
    Below is an example with prepared statement - but not what I want to do
    For example:
    String oddstringwithunusalcharacters = "...";
    String query = "insert into blahtable (somestring) values (?)";
    PreparedStatement stmt = connection.prepareStatement(query);
    stmt.setString(1, oddstringwithunusalcharacters);
    I would like to see what the actual query looks like and what the actual string was passed:
    --> insert into blahtable (something) values ("asdfds\'\s sdsfdasfd \"\& .... ")
    It is not sufficient enough for me to escape quotes and apostrophes because there maybe other unusual characters that I do not know of since the string is passed by an unknown source.
    Thank you in advance

    PreparedStatements actually doesn't escape quotes. It basically precompiles statements in the DB and only passes the values to the DB.
    But if you're using a plain vanilla SQL statement where you quote the string with a single quote ' then you need to escape all occurrences of exactly the same single quote ' in the actual String value. If you for example quote the string with an apostrophe ` then you just need to escape all occurrences of exactly the same apostrophe ` in the actual String value. And so on. It is nothing more than logical, is it?

  • Saving session state during pagination

    See
    http://htmldb.oracle.com/pls/otn/f?p=24317:152
    I hacked into the PPR function to save the checkbox value into session state during pagination.
    Is there a way to do something similar for checkboxes in the report itself rendered using htmldb_item.checkbox()?
    Or is this an ill-advised effort?
    [The UI requirement here is clear...I have a bunch of items over many pages and I want to select them using checkboxes and have the selections remembered as I paginate back and forth.
    If you use Yahoo Mail, Compose a new message, click on the Insert Addresses link and it pops up a window with all your contacts, you can select them using checkboxes and go to the Next/Previous page and it remembers the selections]
    Thanks

    See
    http://htmldb.oracle.com/pls/otn/f?p=24317:152
    Click on the Create/Reset collection button to initialize your own private collection to play with.
    The checkboxes are remembered as you paginate thru the resultset. Basically, the state of the checkboxes is saved into session state using htmldb_Get before calling the PPR function to get the next/previous rows.
    Carl, let me know what you think of the approach. Is it a viable approach? Any caveats?
    [Unfortunately, I had to to make a copy of the builtin html_PPR_Report_Page function to make the above modification in it, didnt see a way to avoid it]
    Thanks

  • Statement is not valid in a namespace site

    i'm an amateur programming, and it's my 1st project!! 
    But the thing is I am having a problem . In error list it says "Statement is not valid in a namespace
    Need advise what to do with this error

    i'm an amateur programming, and it's my 1st project!! 
    But the thing is I am having a problem . In error list it says "Statement is not valid in a namespace "
    Need advise what to do with this error
    You need to learn the structure of a program. You can not just place code willy nilly anywhere and think that will work.
    Also you need to know what code can go where also. That will take time too. The information below is from the second link below. But when you read it you need to realize the difference in methods used by a console application and most other project styles.
    So if you are unaware of that you may end up not understanding why certain information is not necessary for a Windows Forms app while other information is not necessary for a console app.
    For example the Main Procedure I see used in console apps. In Windows.Forms apps not so much except for possibly extremely old VB.Net code and mostly I would have to guess by people who used to write console apps all the time then tried Windows.Forms apps
    and for whatever reason couldn't refrain from using console app procedures in Windows.Forms apps which is unecessary and in my opinion quite confusing.
    TutorialsPoint - VB.Net - Program Structure
    Structure of a Visual Basic Program
    File-Level Programming Elements              
    When you start a project or file and open the code editor, you see some code already in place and in the correct order. Any code that you write should follow the following sequence:
    Option                  
    statements
    Imports                  
    statements
    Namespace                  
    statements and namespace-level elements
    If you enter statements in a different order, compilation errors can result.
    A program can also contain conditional compilation statements. You can intersperse these in the source file among the statements of the preceding sequence.
    Option Statements                  
    Option                  
    statements establish ground rules for subsequent code, helping prevent syntax and logic errors. The
    Option Explicit Statement (Visual Basic) ensures that all variables are declared and spelled correctly, which reduces debugging time. The
    Option Strict Statement helps to minimize logic errors and data loss that can occur when you work between variables of different data types. The
    Option Compare Statement specifies the way strings are compared to each other, based on either their
    Binary or Text values.
    Imports Statements                  
    You can include an Imports Statement (.NET Namespace and Type) to import names defined outside your project. An
    Imports statement allows your code to refer to classes and other types defined within the imported namespace, without having to qualify them. You can use as many
    Imports statements as appropriate. For more information, see
    References and the Imports Statement (Visual Basic).
    Namespace Statements                  
    Namespaces help you organize and classify your programming elements for ease of grouping and accessing. You use the
    Namespace Statement to classify the following statements within a particular namespace. For more information, see
    Namespaces in Visual Basic.
    Conditional Compilation Statements                  
    Conditional compilation statements can appear almost anywhere in your source file. They cause parts of your code to be included or excluded at compile time depending on certain conditions. You can also use them for debugging your application, because conditional
    code runs in debugging mode only. For more information, see Conditional Compilation in Visual Basic.
    Namespace-Level Programming Elements              
    Classes, structures, and modules contain all the code in your source file. They are
    namespace-level elements, which can appear within a namespace or at the source file level. They hold the declarations of all other programming elements. Interfaces, which define element signatures but provide no implementation, also appear at module
    level. For more information on the module-level elements, see the following:
    Class Statement (Visual Basic)                  
    Structure Statement                  
    Module Statement                  
    Interface Statement (Visual Basic)                  
    Data elements at namespace level are enumerations and delegates.
    Module-Level Programming Elements              
    Procedures, operators, properties, and events are the only programming elements that can hold executable code (statements that perform actions at run time). They are the
    module-level elements of your program. For more information on the procedure-level elements, see the following:
    Function Statement (Visual Basic)                  
    Sub Statement (Visual Basic)                  
    Declare Statement                  
    Operator Statement                  
    Property Statement                  
    Event Statement                  
    Data elements at module level are variables, constants, enumerations, and delegates.
    Procedure-Level Programming Elements              
    Most of the contents of procedure-level elements are executable statements, which constitute the run-time code of your program. All executable code must be in some procedure (Function,
    Sub, Operator, Get,
    Set, AddHandler, RemoveHandler,
    RaiseEvent). For more information, see Statements in Visual Basic.
    Data elements at procedure level are limited to local variables and constants.
    The Main Procedure              
    The Main procedure is the first code to run when your application has been loaded.
    Main serves as the starting point and overall control for your application. There are four varieties of
    Main:
    Sub Main()
    Sub Main(ByVal cmdArgs() As String)
    Function Main() As Integer
    Function Main(ByVal cmdArgs() As String) As Integer
    The most common variety of this procedure is Sub Main(). For more information, see
    Main Procedure in Visual Basic.
    La vida loca

  • Filter in MDX Statement

    I have a very basic MDX statement which contains a FILTER statement:
    WITH
    SET [Selected Discipline] AS STRTOSET(@Disciplines, CONSTRAINED)
    SET [Selected Department] AS STRTOSET(@Departments, CONSTRAINED)
    SET [Selected Departments] AS IIF(@Disciplines = @Departments,
    FILTER(
    DESCENDANTS([Selected Discipline], [Employee].[DISC - DEPT - EMP].[Department], AFTER),
    NOT INSTR([Employee].[DISC - DEPT - EMP].CurrentMember.UNIQUE_NAME, "Freelance")),
    DESCENDANTS([Selected Department], [Employee].[DISC - DEPT - EMP].[Department], AFTER))
    SET [TTM] AS { LastPeriods(12, StrToMember(@SelectedMonth, CONSTRAINED)) }
    SELECT
    [Measures].[Employee Hours],
    [Measures].[Employee Hours %]
    } ON COLUMNS,
    NON EMPTY CROSSJOIN(
    [Selected Departments],
    [Employee].[Employee Bill Rate].[Employee Bill Rate].ALLMEMBERS,
    [Employee].[Employee Level].[Employee Level].ALLMEMBERS,
    [TTM]) ,
    FILTER ([Employee].[Manager Name].[Manager Name].Members ,
    NOT InStr([Employee].[Manager Name].CurrentMember.MEMBER_NAME, "O-Tern"))
    DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
    FROM [OLSON BI]
    WHERE (
    [Employee Hours Time Category].[Time Category].&[Client Facing],
    [Employee Hours Time Category].[Utilization Category].&[PRODUCTION])
    CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT
    When running the query, I get the "Failed to parse the query to detect if it is mdx or dmx".
    THe qqy=uery is basic enough, but for the life of me can't figure out what is wrong????
    Any suggestions woud be greatly appreciated!!
    Thanks
    A. M. Robinson

    I literally have the exact same query running in a different report and it runs fine.
    Also, your FILTER is in a SET statement - mine is not. That is the major difference between my query and yours.
    SELECT
    [Measures].[Employee Hours],
    [Measures].[Employee Hours %]
    } ON COLUMNS,
    NON EMPTY CROSSJOIN(
    [Selected Departments],
    [Employee].[Employee Bill Rate].[Employee Bill Rate].ALLMEMBERS,
    [Employee].[Employee Level].[Employee Level].ALLMEMBERS,
    [TTM]) ,
    FILTER ([Employee].[Manager Name].[Manager Name].Members ,
    NOT InStr([Employee].[Manager Name].CurrentMember.MEMBER_NAME, "O-Tern"))
    If I remove the filter statement from this query and run it WITH the same parameters it runs fine - and has been running fine for literally over a year. The introduction of this FILTER statement is causing an issue.
    So either the filter is in the wrong place or it's not formed properly.
    I can provide a couple of examples of queries that are the ecact same with parameters and run fine, and when a FILTER is introduced they still run fine.
    A. M. Robinson

  • Hub 4 detailed connection stats??

    Hello
    Got my new hub 4 , all plugged in and working .However I can only get basic connection stats such as upload/download speed and time.
    Where are detailed stats that I had with my hub 3??
    Cheers
    Oliver

    I read the parts of the linked chat thread regarding disabling the noise/attenuation stats, and the reasoning for leaving it out does not make sense at all. Users are not going to lose sleep over extra technical information in the "Advanced" section - they know it's there for techincal support if they need it.
    Heck, you could even completely hide it by not having a clickable link anywhere and only tell people about the HomeHub "special" link on the forums or BT support - then people won't get confused if they click where they shouldn't.
    There are plenty of posts on these forums from people with older HomeHubs where they copy their stat page and people on the forum are able to easily identify what is going wrong (noise margin, etc). Easy for everyone! It is now made much more difficult to dig through logs to find this information now, even for a competent user like myself (I'm a software engineer) who isn't a fan of digging through logs if I can help it.
    I think this really needs to be reconsidered in future firmware versions because - in my opinion - it is insane to completely disable something like this. It certainly wasted a lot of my time looking for it when I expected it to be there.

  • Update Date on SAVE or PRINT (IF Statement)

    Hi,
    I am currently designing a booking form for my company.
    (Link is http://www.sigmastudies.co.uk/downloads/booking_form.pdf)
    I have made a date field at the top of the booking form which is based on an IF statement in FormCalc when the form loads to load the current date if blank.
    Although, what I want to do is for this IF statement only to come into action when the SAVE or PRINT button is pressed at the bottom.
    This would obviously then enable a user to go into the form and have a look before filling it out (... and then saving or printing) without the date updating itself never to update again.
    I am struggling as the SAVE/PRINT button are written in javascript yet the IF statement and date  is written in FormCalc.
    I appreciate any help anyone can offer,
    Thanks
    Will

    Hi Bibhu,
    Thanks for your fast and great help!!!
    It works a dream.
    Although, can I stop the event occurring if someone was to accidently click the date field at the top of the page??
    Also, how did you manager to decrease the file size.
    ALL LOOKS GOOD
    Thanks
    Will

  • Convert Javascript: switch(xfa.event.newText) to Formcalc Syntax

    I was wondering if someone could provide me with the syntax for formcalc for the following javascript. This is used to hide or make visible 2 fields based on a value in a drop down list:
    switch(xfa.event.newText) {
        case 'A - Approved':
            form1.Page1.2nd_Title.presence = "visible";
            form1.Page1.2nd_Signature.presence = "visible";
            break;
       default:
            form1.Page1.2nd_Title.presence = "hidden";
            form1.Page1.2nd_Signature.presence = "hidden";
            break;
    Thanks,
    Mallard27

    Sorry, no simple switch-like statement in FormCalc, although there are convoluted ways to simulate it.  For your example the easiest is if/then/else:
    if (xfa.event.newText == "A - Approved") then
         form1.Page1.TextField1.presence = "visible"
         form1.Page1.TextField2.presence = "visible"
    else
         form1.Page1.TextField1.presence = "hidden"
         form1.Page1.TextField2.presence = "hidden"
    endif
    Also, not sure if you can have object names that start with a number, like "2nd_Title".

Maybe you are looking for

  • Picture too dark

    Why when i print a photo from windows my photo prints just fine.  when i print the VERY SAME photo from photoshop elements it is very very very dark.  Also Why is there such a difference in color from what is shown in photoshop to what prints?????

  • How to move ab object ?

    hello everybody I made a simple wooden car object in 3d studio, exported it to ASE file and loaded to the scene using ASE loader http://img82.imageshack.us/img82/3306/samochodfv8.jpg thats the beauty =) now, I would like to move him using KeyNavigato

  • I am looking for a projector to connect to my iPad for a business application.

    I have an iPad that I want to connect to a projector so I can do presentations.  I also need to be able to project information from a password protected business website.

  • Smart Collection gymnastics

    Who finds Smart Collections to behave in a most peculiar fashion? They certainly do when dealing with collections. If I create a Smart Collection with attributes: "Match all; Collection contains all Jewellery brochure; Rating is 5 stars", then I find

  • I want to use Thunderbird on my IPad and I can't install it for some reason

    I can not figure out how to install Thunderbird on my IPad