Public/Global variable within an If statement..

Is there way to declare a variable as Public in an IF statement. My goal is to declare the variable as global (since this variable is used somewhere in the code and should not get initialized when there is loop back to the top of the code, hence using IF statement to control the initialization) based on the IF condition and then use it elsewhere in the code.
I have it like this
if (!sei_second_jsp.equals("1"))
public int[] mecitem;
public String[] sei_mfg_prod_cat;
public String[] sei_part_number;
public String[] sei_descrip;
public String[] sei_price;
public int[] sei_onhand;
public int[] sei_demand;
mecitem = new int[20000];
sei_mfg_prod_cat = new String[20000];
sei_part_number = new String[20000];
sei_descrip = new String[20000];
sei_price = new String[20000];
sei_onhand = new int[20000];
sei_demand = new int[20000];
for (int i=0; i<=19999; i++)
mecitem[i] = 0;
sei_mfg_prod_cat[i] = " ";
sei_part_number[i] = " ";
sei_descrip[i] = " ";
sei_price[i] = " ";
sei_onhand[i] = 0;
sei_demand[i] = 0;
Your guess is right, I am using this code in JSP - since this is a Java related question, thought of posting it in JAVA forum.
When I use the above code, I get the following error
1809 }' expected. { 
1811 Statement expected. public int[] mecitem;
1827 Identifier expected. mecitem = new int[20000];
1827 Can't specify array dimension in a declaration. mecitem = new int[20000];
1827 Identifier expected. mecitem = new int[20000];
1837 Can't specify array dimension in a declaration. sei_onhand = new int[20000];
1837 Identifier expected. sei_onhand = new int[20000];
1839 Can't specify array dimension in a declaration. sei_demand = new int[20000];
1839 Identifier expected. sei_demand = new int[20000];
3117 Class or interface declaration expected. }
I will post the same in JSP forum as well.. thnks a lot

1809 }' expected. { I would guess that you have a syntax error above this error. The other errors are caused by that.

Similar Messages

  • How to Set and Use a global variable within a session?

    Dear All,
    I'm new to jsp, and would like to ask how to set and use a global variable within a session?
    Thanks in advance.
    Regards,
    Cecil

    With session.setAttribute("name",object) you can store a Attribute in the session object.
    with session.getAttribute("name") you can get it.
    That's it.
    Regards,
    Geri

  • How do I use a variable within a sql statement

    I am trying to use a local variable within an open SQL step but I keep getting an error.
    My sql command looks like this "SELECT BoardDetailID FROM BoardDetails WHERE SerialNumber = " +  locals.CurrentSerialNo
    If I replace the locals.CurrentSerialNo with an actual value such as below the statement works fine.
    "SELECT BoardDetailID FROM BoardDetails WHERE SerialNumber = " +  " 'ABC001' " 
    Can someone tell me how to correctly format the statement to use a variable?

    Hi,
    Thanks for the reply. I have changed the required variable to a string, but with no success. I have reattached my updated sequence file and an image of the error.
    When looking at the Data operation step I see that the sql statement is missing everything after the last quotation mark.
    Thanks again,
    Stuart
    Attachments:
    Database Test Sequence.seq ‏10 KB
    TestStand error.JPG ‏37 KB

  • Variable within an import statement

    I'm wanting to have a variable in an import statement for different versions of a class
    example - import someclass.VERSION.*;
    but I want VERSION to be a variable that I can modify for every project that uses the class I'm importing from. I have not found any examples that have done this thus far.

    The point of my suggestion was that it would make it unnecessary to change anything at all for compiling different versions.
    make 3
    Making version 3.0 <<<See how easy that can be? Reading the version of the class to load from an external class file and dynamically loading it is tantamount to a Rube Goldberg machine. Also, you still have to change a file, your properties file. If your project grows to any significant size, this approach will cause you serious headaches.

  • Using a global variable within a function

    Hi all,
    I'm trying to learn how to use global variables, but can't quite get it right:
    Im trying to use two buttons, named UpButton and DownButton to control one global variable, p1
    A text field, named "Value" displays p1.
    Here's my code:
    p1 = 0;
    ButtonClick("UpButton", p1, 100,"Value");
    ButtonClick("DownButton", p1,(-100),"Value");
    function ButtonClick(ButtonName,Var,Increment,TextToChange){
                        sym.$(ButtonName).click(function(){
                        Var = Var + Increment;
                        sym.$(TextToChange).html(Var);
    However, it seems to be treating p1 as two different variables.
    Here's a link to the page to show you what I mean, apologies but this link wont work in google chrome because I'm using dropbox as a server temporarily
    In other browsers you may need to click "Show all content" or similar to any security warnings...
    https://dl.dropboxusercontent.com/u/83693404/ButtonTest/buttons.html
    Here are the project files:
    https://app.box.com/s/0shocivto8fl295h62uq
    Any help greatly appreciated, sorry if this is a stupid question,
    Katherine

    Hi Katherine,
    However, it seems to be treating p1 as two different variables.
    Indeed, your code created two different variables in two different scopes (I guess it as to do with JavaScript closures, but do  not ask me more, I am still a bit foggy about that idiosyncrasy ).
    In JavaScript, a primitive parameter – this is the case here with p1, a Number value –, is passed by value. In other words, a copy of the value is made. Your code handles two copies of the value stored in p1.
    This contrasts with an object parameter, which is passed by reference (address in memory), without copy. Your code would work if Numbers were passed by reference : the two Var (p1) would then point to the same address.
    The intent behind your trial is a global variable.
    1) Let us be as simple as possible :
    Stage : document.compositionReady event handler
    p1 = 0;
    buttonClick = function( Increment)
      p1 += Increment;
      sym.$( "Value").html( p1);
    Stage : DownButton.click event handler
    buttonClick(-100);
    Stage : UpButton.click event handler
    buttonClick(100);
    Without being preceded by the var keyword the variables are global.
    So the Number variable p1 can be accessed inside function buttonClick.
    And the Function variable buttonClick as well, is accessible inside click event handlers, everything (function definition +function calls) being inside the same symbol (Stage).
    2) Now, suppose this is no longer the case : you want to access a variable from another symbol.
    We create a new GraySquare symbol, instantiated both in the DownButton symbol (instance name DownSquare) and in the UpButton symbol (instance name DownSquare).
    Stage : document.compositionReady event handler
    p1 = 0;
    sym.buttonClick = function( Increment)
      p1 += Increment;
      sym.$( "Value").html( p1);
    The sym. prefix is now necessary to make the variable (here a Function, but you would proceed exactly the same with a String, Number or Boolean) accessible in other symbols.
    DownButton symbol : DownSquare.click event handler
    sym.getComposition().getStage().buttonClick( -100);
    UpButton symbol : UpSquare.click event handler
    sym.getComposition().getStage().buttonClick( 100);
    From these other symbols, the sym.getComposition().getStage(). prefix is necessary to acces to our global variable (function).
    The two examples are downloadable here : https://app.box.com/s/6vkyiqk7i8zwlw0j1wk1
    Gil

  • Setting a Stored Procedure Variable within a CASE Statement

    I am attempting to build a Merge/Purge Key of our Members and am trying to use this syntax...
    /* The First Part of the Merge/Purge Key is built on the first 4 consonants of [member].[NAME_LAST] */
    SELECT
    CASE
    WHEN SUBSTRING([@NameLast],@Counter,1) <> 'A'
    AND SUBSTRING([@NameLast],@Counter,1) <> 'E'
    AND SUBSTRING([@NameLast],@Counter,1) <> 'I'
    AND SUBSTRING([@NameLast],@Counter,1) <> 'O'
    AND SUBSTRING([@NameLast],@Counter,1) <> 'U'
    THEN CASE
    WHEN @Counter = 1
    THEN @MergePurgeKeyLastNamePos1 = SUBSTRING([@NameLast],@Counter,1)
    I cannot seem to set my Storage Variable @MergePurgeKeyLastNamePos1 with the non-consonant value that it finds.
    Do I need to over simplify this first by setting some CHAR(1) Storage Variable and then building the 4-character Merge/Purge Key of Last Name?
    Thanks for your review and am hopeful for a reply?

    >THEN @MergePurgeKeyLastNamePos1
    =SUBSTRING([@NameLast],@Counter,1)
    Assignment cannot be done in a case THEN. Only a scalar value can be returned.
    You can do assignment like SELECT @variable = CASE.....
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

  • Global Variable in JAVA

    Hi I am new to Java but have been programming in other languages for sometime.
    What I want to achieve is to have some global variables that I can use in other classes. This was particularly difficult because I want to use these global variable in Switch/Case statements. I thought this was solved by creating the following class
    public final class IntObj {
    public static final int ftsefut_contract_id = 2;
    so in another class i would use IntObj.ftsefut_contract_id in the switch/case and it worked. However, i now am begining to think this is not working. Usng NetBeans, if I change the value of ftsefut_contract_id from 2 to 3 and "clean and rebuild", I am still seeing the value of ftsefut_contract_id to be 2 and not the new value (ie 3) that I have inputed. Can someone please explain is there a better method of having global variables and if not how do I get NetBean or the project to flush itself and reload the new values each time I rebuild.
    Thanks

    That behaviour is explicitly permitted by the Java specifications.
    Use an enum.

  • Global variable in Mapping

    Hi,
    Is there a way to declare a global variable in a mapping? e.g if I want to use a counter variable...
    Zahid

    Hi again,
    I've previously used the mapping input parameters successfully to bind a name (read-only) to the value of an expression, which is particularly effective when you want to filter an ODBC source with a non-trivial expression, which otherwise means the filtering is done on the target side (expensive).
    Unfortunately, Zahid wants to change the global variable within a transformation, and that is a side effect I believe is not allowed in SQL (set mode). Also, transformations live in a separate PL/SQL package, which means that the transformations have no access to the mapping input parameters. Hence my (untested) suggestion that using row mode and developing a separate "global variable" package might do the trick.
    Regards, Hans Henrik

  • Global Variable Declaration in PI 7.1 EHP 1

    Hi Experts
    How can I declare the Global Variables in PI 7.1 EHP 1 , please let me know if there is any blog in Enhancement Pack 1
    Thanks
    PR

    On PI7.1 global variables have been removed.
    You can try one of the following:
    1. Create a global variable within an UDF;
    2. Use the solution from the blog below:
    /people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable

  • Using a var within an Include statement

    What syntax do I use in order to put a variable within an Include statement...
    <%@ include file="<%= varhere %>.htm" %>
    Thanks for any help!

    use
    <include>
    <param name=" something " value="34"/>
    </include>

  • Looking for something more robust than global variables

    Hi,
    The company I work for makes really big deals based on the Forms we develop,
    and it makes me edgy to rely on :Global.variables to assign big amounts of money
    to a field or another.
    Maybe someone could direct me to a paper about a more robust scheme to run tests deciding what is going to happen next, like calling another form or populating another block?
    Many thanks :-)
    Message was edited by:
    JeanParis

    JeanParis,
    I did a quick Google search, but didn't find any reference material on you question so I'll give you my personal preference. Bear in mind, it truly was a "quick" search. I'm sure there is information about this topic somewhere.
    I use a Global Variable (GV) when a value is needed by significant number of Forms in the application. If the value of the is only needed by a few Forms, then I use a Parameter List. When I do use GVs, I only use them for as long as I need them. In other words, I'll assign the value of the GV to a Forms Block Item (base table or Control Block) or a parameter and then set the value of the GV to NULL. This ensures the value is only available "Globally" for as long as it is absolutely needed. This does cause a little extra work, but it make the Form safer in my opinion.
    If I simply need to have access to a "Global Variable" within the scope of a single form, I prefer to use a Form Parameter (FP). I like using using FPs over a Control Block (CB) Item because there is less overhead (attributes of a FP) than with an Item (attributes of the Item) in a CB. I know this is nit-picking, but there is a cost associated with each attribute that is loaded into memory and I like to keep this cost to a minimum. (I suppose if you sub-classed your CB Item then it would share the attributes and reduce the overhead even more). I develop Forms for the web using Forms 10g so any time I can shave off the load-time of my Form is worth it to me.
    Hope this helps.
    Craig...
    Message was edited by:
    CraigB
    Steve beat me to the punch. I like his option as well and have used this method a time or two. :-)

  • Global variable in servlet & DBPooling questions

    Hello guys,
    I used to develop PHP/ASP, and am new to servlet. I have been searching around for a solution ...
    With Php, we can get the reference of a global variable in any classes->functions...
    How do I do this with servlet ?
    And second..I have developed the DB class as below... I set the datasource to be static, so it initializes only once. Is it a good idea? How would you like to improve this class? any comments?
    package shop.database;
    import javax.sql.DataSource;
    import java.sql.*;
    import org.apache.commons.dbcp.BasicDataSource;
    import org.apache.log4j.Logger;
    import shop.admin.exception.GeneralException;
    public class DdManager {
         static protected Logger logger = Logger.getLogger(DdManager.class);
         private String userName = "root";
    private String password = "";
    private String hostName = "jdbc:mysql://localhost:3306/shop";
    private String database="shop";
         static private DataSource ds;     // set this to be static so all threads share the same job in JVM
         private Statement stmt;
         private Connection conn;
         private ResultSet rs;
         private CallableStatement cs;
    public DdManager() {}
    * setup the data source and return it
         public static DataSource getDataSource(
              String sDrvName,
              String sUserName,
              String sPwd,
              String connectURI) {
              BasicDataSource ds = new BasicDataSource();
              ds.setDriverClassName( sDrvName );
              ds.setUsername( sUserName );
              ds.setPassword( sPwd );
              ds.setUrl( connectURI );
              ds.setMaxActive( 15 );
              ds.setMaxIdle( 10 );
              ds.setMaxWait( 10000 ); // 10 seconds
              return ds;
         * static init of the class
         * this class is will be called only once to initialize the DataSource
         static {
              try {
                   Class.forName( "com.mysql.jdbc.Driver" );
                   ds = getDataSource(     "com.mysql.jdbc.Driver",
                                            "root",
                                            "jdbc:mysql://localhost:3306/shop" );
                   if (ds == null) {
                        String msg = "Connection Pool error";
                        logger.error(msg);
                        throw new GeneralException(msg);
                   logger.info("DataSource has been initialized");
              } catch(Exception exception) {
                   logger.error(exception.toString());
                   try {
                        throw new GeneralException(exception.toString());
                   } catch (GeneralException e) {
                        logger.error(e.toString());
         * get the connection from the pool (DataSource)
    public void openConnection() throws GeneralException {
    try {
         BasicDataSource bds = (BasicDataSource) ds;
         logger.info("NumActive: " + bds.getNumActive() + ", " + "NumIdle: " + bds.getNumIdle());
    conn = ds.getConnection();
    logger.info("Connection of " + database + " has been established");
    } catch(Exception exception) {
         logger.error(exception.toString());
         throw new GeneralException(exception.toString());
    * close the connection will actually return the connection to the pool (Must)
    public void closeConnection() throws GeneralException {
         initResource();
    try {
         if (conn != null){
                   conn.close();
                   logger.info("Connection of " + database + " has been closed");
    } catch(SQLException exception) {
         logger.error(exception.toString());
         throw new GeneralException(exception.toString());
    * prepare the calling stmt
    public void prepareProcedure(String callStatement) throws GeneralException {
         initResource();
    try {
         cs = conn.prepareCall(callStatement);
    } catch(SQLException exception) {
         logger.error(exception.toString());
         throw new GeneralException(exception.toString());
    * set the pass-in parameter for "String"
    public void setParameter(int position, String parameter) throws GeneralException {
    try {
         cs.setString(position, parameter);
    } catch(Exception exception) {
         logger.error(exception.toString());
         throw new GeneralException(exception.toString());
    * set the pass-in parameter for "Integer"
    public void setParameter(int position, int parameter) throws GeneralException {
    try {
         cs.setInt(position, parameter);
    } catch(Exception exception) {
         logger.error(exception.toString());
         throw new GeneralException(exception.toString());
    * execute the procedure and return the resultset
    public ResultSet execProcedure() throws GeneralException {
    try {
         rs = cs.executeQuery();
    } catch(SQLException exception) {
         logger.error(exception.toString());
         throw new GeneralException(exception.toString());
    return rs;
    * close the statment and resultset
         private void initResource() throws GeneralException {
         try {
              if(rs != null) {
                   rs.close();
              if(stmt!= null) {
                   stmt.close();
              logger.info("Statement & Resultset have been free");
         } catch(Exception exception) {
         logger.error(exception.toString());
         throw new GeneralException(exception.toString());
    Thanks mates!
    myy

    Thanks Saish,
    Your response is really appreciated. Sorry about that
    as i didnt know there is 'code' formatting button,
    and I will look into the Singleton pattern.
    As I'm still in the learning stage. Therefore, i
    still have a lot of thing do not understand.
    ... use it in a method signature ...What is "a method signature" ?
    A method signature is basically the method's parameters, return value, name and any access or other modifiers. The following is a method signature:
    static final public void main(final String[] args)Between the braces of the method body is the implementation (or as I already alluded to, the method body).
    Consider using an already-developed connection poolimplementation, such as Jakarta Commons DBCP ...
    I'm trying to implement the Jakarta DBCP. Did I go
    into the wrong way?
    Sorry, did not read the imports. Yes, you are. However, I am confused about what you are trying to implement. You have a static method getDataSource(). You also have a static variable 'ds'. Use one or the other. I would be that there are seemingly random errors cropping up based on whether you remember to call getDataSource() or not.
    You do not, generally, want the data source to be static. Multiple threads might use the class. And if there is only a static data source, you will either need to synchronize the methods that use the data source (resulting in a scaling bottleneck) or not synchronize them (which will totally destroy any concept of a logical unit of work or database transaction).
    .. A static datasource, as in your class, can onlysafely be used by one thread at a time, potentially
    introducing scaling bottlenecks (or race conditions)
    in your system ...
    So, you mean there is no need for the DataSource to
    be static ?
    No, in fact, IMO, it should not be. That is why you are pooling. Use instances. The pool will manage the connections and their availabilty for you.
    Why are you throwing GeneralException everywhere?Here's a question: can someone using your class (a
    caller) realistically be expected to handle a
    database exception?
    When there is a database error, I just want to stop
    the process and redirect the user to an error page. I
    will look into the unchecked exceptions. Thanks.
    Unchecked exceptions do not need to be declared in a method signature or caught within the method body. Checked exceptions do. As such, an added benefit is that unchecked exceptions de-clutter your code.
    In your initResources() method, what happens if theclose() on ResultSet throws an exception
    Oh, yes. I'm so stupid.
    Now I only have ...
         private static DataSource ds;     // set this to
    be static so all threads share the same obj in JVM
         private Connection conn;
         private CallableStatement cs;
    private void initResource() throws GeneralException
    n {
         try {
              if(cs != null) {
                   cs.close();
    logger.info("CallableStatement has been
    as been free");
         } catch(Exception exception) {
         logger.error(exception.toString());
    throw new
    throw new GeneralException(exception.toString());
    You still have issues.
    public void initResources() {
       if (rs != null) {
         try { rs.close(); } catch (SQLException ignore) { ignore.printStackTrace(); }
       if (stmt != null) {
         try { stmt.close(); } catch (SQLException ignore) { ignore.printStackTrace(); }
    }Normally, this type of method would not be called initResources() but rather closeResources() or freeResources(). It would be called from within the 'finally' block of another method using the CallableStatement or ResultSet.
    This is really is problem, would you mind to tell me
    how to handle this(close the connection) if the
    close() on either CallableStatement or Resultset
    throws an exception ?
    See above. Simply log the exception (there is usually nothing meaningful you can do if a close() fails, and it is up to you as a developer if this is an error or just a warning). Another option is to 'chain' exceptions. In your own exception, add a method 'addException(Throwable)'. This would add another exception to a List of exceptions. When you print the stack trace, iterate through the chained exceptions to print them all out. One place where I find this useful is rollback() code. If the original SQL statement fails AND the rollback fails, I definitely want to see that rollback() exception as well in my logs.
    The DB thing makes me headache. What I actually
    wanted is a solution for:
    Let say I have a class "HelloAction.class" contains
    the code:
    public ActionForward XXX() {
         DbManager DB = new DBManager();
         ... do some DB thing here...
         SecondClass SC = new SecondClass();
         SC.doSomeOtherDbThing();
         ... do something else...
         ThirdClass TC = new ThirdClass();
         SC.doMoreOtherDbThing();
    }There are some functions in SecondClass.class and
    ThirdClass.class that will need database connection.
    I consider 'global variable' is because I want these
    two classes are able to use the same
    connection(DbManager) from the function -
    ActionForward XXX().
    What is the best way to implement the above situation
    (sharing the same connection in different classes &
    sub-classes?
    I also just realize that the problem of multi-threads
    with these two class variables..
         private Connection conn;
         private CallableStatement cs;Really headache. I really appreciate any comments.
    Thanks.
    - myyPass the Connection or DataSource to each method or constructor. Call commit() or rollback() from the method that created the transaction.
    - Saish

  • Function module Global variables not cleared from memory?

    Hi,
    This is may be simple & stupid question ( after posting  4242 posts ):)
    " Declaration in TOP
    data : begin of i_y1yatt occurs 0.
            include structure y1yatt.
    data : end of i_y1yatt.
    types: begin of t_yatt71.
           include structure yatt71.
    types: tcode like sy-tcode.
    types: dflag type c.
    types: end of t_yatt71.
    data : i_yatt71 type standard table of t_yatt71
                   with default key  with header line  initial size 0.
    This is code in the function module.
      loop at i_y1yatt.
        move-corresponding o_y1yatt to i_yatt71.
        if i_y1yatt-werks eq 'N501'.
           move space to i_yatt71-werks.
        endif.
        append i_yatt71. 
        " Here this internal contains the previous entry
        clear i_yatt71.
      endloop.
    This function module is called 25 times in a minute.
    My problem is this
    For example : 1st tranmission is called this fm with 50 records,
    and 2nd tranmission is called fm with 10 records.
    My results are showing
    last record in the 1st transmission is still on the memory while calling 2nd transmission.  ( Here in int table I_YATT71 still contains the 1st transmission's last records during the 2nd tranmission call)
    As per my knowledge if each time calls comes in to fm all gloabl variables get cleared. but some how this not happening.
    Anybody come across this scenario.
    PS. I know i need to use clear statement within the loop as first statement.

    You must understand that when calling a FM, you load the entire function group into memory. IF there are global variables, then they are "alive" for the entire duration of the program execution. Meaning if you call the function numerious times, or even if you call another function within the same function group, the functions still have access to that same global variable space, so it must always be cleared manually by the developer at the required points.  You can not rely on the runtime to clear the global variables at the end of the function call.  So you should clear all you globals as the first operation in your function module call, if that is what is required.
    Is this clear?
    Regards,
    Rich Heilman

  • Setting the value of an Application Item (setting a global variable);

    In APEX 3.2.0.00.27, I need to initialize a global variable to 0 to implement a variable for testing to see if anything on the page has changed. Will update to 1 when certain select lists on the page are changed. Have read through some similar questions and replies within the forum as well as other blogs and sites. So, I believe what I am doing is the way to go about this. Unfortunately, my initialization of an application item/global isn't happening yet. here's a rundown of what has been implemented:
    1) created an application item, G_CLASSIFICATION_ID_NEW in the shared components;
    2) created Javascript (JS) function called by addLoadEvent in the page html header region so when the page loads, the G_CLASSIFICATION_ID_NEW global/application item should get set to 0 with the following JS and using AJAX and htmldb_GET:
    <script type="text/javascript">
    function initVars()
    alert("before get initvars");
    var get = new htmldb_Get(null,$x('pFlowId').value,null,22);
    get.add('G_CLASSIFICATION_ID_NEW', 0);
    gReturn = get.get();
    if(gReturn){
    alert(gReturn.value);
    get = null;
    alert("after get initvars");
    alert("before call to initpage");
    addLoadEvent(initVars());
    </script>
    I've used the htmldb_Get with success for populating other global variables and running On Demand Processes with onchange JS calls in the html form element attributes within select lists on the page. Afterwards, I can check the globals via the Session window and searching on Application Items. Unfortunately, I'm missing something because my G_CLASSIFICATION_ID_NEW never gets populated when I load the page. The alerts all popup when the page is loaded, so I know the script is being executed when the page loads. the alert(gReturn.value) comes back undefined. And, needless to say, the G_CLASSIFICATION_ID_NEW to 0 is not occurring.
    I've tried the htmldb_Get with it calling an application process and without (set to null). From what I've read, you shouldn't need to call an on demand process to have the get.add set the global variable. Then again, this could be where I'm going wrong. however, as I've mentioned, this works for other functions called from an onchange to populate an application item, but the page has already loaded when the onchange(s) get executed. They may work because the page is already loaded when the onchange is called. My point here is that my other On demand processes are NOT setting or changing the global variables at all. The globals are getting set with the get.add(<app item>, <value>) portion of my other JS functions within the HTML Header region. So, I'm inclined to believe that I don't need the 'application_process=<some_odp>' parameter set, but if that's not true, please let me know. if so, what would need to be in the on demand process--ie, what would be the purpose of the get.add(<application item>, <value>) if I set the global variable in the on demand process because that's the only thing I could think of doing within an on demand process for this?
    If somebody can point out what I'm not understanding or failing to do here, that would be great. I'm doing fine with APEX, but wouldn't consider myself a guru with it just yet. I'm definitely not a JS/AJAX guru, and when things like this go astray, I get bogged down because I'm not sure of the problem. So, I'm hoping you gurus who monitor this forum can get me going in the right direction.
    thanks,
    bob

    Hi Jari,
    Does that javascript work if you place it some of region footer on page 22 ?Yes. I cut it out of the html header of the page, and put it in the footer of the first region on the page. It initializes the variable. Putting it into the footer of the first region on the page should work for me instead of having an extra region on the page that's being picked up from page 0.
    Is your page 22 authentication public ?No. This particular page is set for an ADMINISTRATOR only. That said, I am logged in as an administrator. So, I cannot see why setting authentication should make a difference as long as I have that authentication/authorization. Also, there will be other pages where I want to use this script or a similar script, but again, those pages will not be open to the public. the authentication will be "role" based where a user will not necessarily have to be an administrator, but they will have to have a certain role to access the page. Is there a known problem or something that precludes a html header JS script from doing an addloadevent when authentication is NOT public?
    thank you,
    bob

  • Timeline. How does (or does not) update global variables?

    Hello All,
    I am having problems to understand how a timeline updates values. In my case the timeline is supposed to change an index within a second always by incrementing it by one or decrementing by one. Basically I am trying to create a mosaic of images that when I press left key all the columns move to left and when I press right key all the columns move to right.
    To do this I have a deltaX constant that defines the translation.
    Then I have a global tracker initialized to 0 and then udated +1 if move to right, -1 if move to left.
    The Timeline is:
    public var tracker: Number = 0;
    var thumbnails: ImageView[] = bind for (column in [0..appModel.CATALOG_COLUMNS + 1]) {
                    for (row in [1..appModel.CATALOG_ROWS]) {
                        def imageView: ImageView =  ImageView {
                                    image: bind catalogData.dataAt(row, column)
                                    x:  bind (column - 1)*catalogData.maxThumbnailWidth + column*xSpacing
                                    y:  bind ySpacing + (row - 1) * (catalogData.maxThumbnailHeight + ySpacing)
                                    translateX: bind tracker*deltaX
                                    transforms:  bind [
                                        Rotate {
                                            angle: bind direction * rotation
                                            pivotX: bind imageView.x + imageView.boundsInLocal.width / 2
                                            pivotY: bind imageView.y + imageView.boundsInLocal.height / 2
        override public function create(): Node {
            return Group {
                        content: bind thumbnails
    public function rotateAndTranslateToRight(): Void {
            direction = 1;
            translateAndRotateTimeline.stop();
            translateAndRotateTimeline.play();
        public function rotateAndTranslateToLeft(): Void {
            direction = -1;
            translateAndRotateTimeline.stop();
            translateAndRotateTimeline.play();
        var translateAndRotateTimeline = Timeline {
            def initialValueTracker = tracker;
                    keyFrames: [
                        KeyFrame {
                            time: 0s
                            values: [
                                 rotation => 0,
                                 tracker => initialValueTracker
                        KeyFrame {
                            time: 1s
                            values: [
                                rotation => 360 tween Interpolator.LINEAR,
                                tracker => initialValueTracker + direction tween Interpolator.LINEAR
                }The problem is that if I first move to right the Timeline works correctly and tracker goes from 0 to 1 in one second, therefore I see a translation to right of tracker*deltaX pixels. So far so good.
    Then if I move to left, I am expecting the Timeline to change tracker from 1 to 0 in one second, but really it is changing tracker from 0 to -1... which of course messes up my translation to left.
    I thought Timeline updates global variables (define outside the Timeline in the context of the class the Timeline is defined) during the transition, but apparently from my observation it doesn't.
    Or maybe I am not defining correctly the Timeline itself and/or the tracker variables?
    Thanks.
    Edited by: sacchett88 on Jun 4, 2010 1:03 PM

    Thanks for the reply... but it didn't help me that much in finding the workaround. I wrote a simpler example to prove the point that can be easily copied and pasted and run. The example draw a circle and for every right key it should move the circle to right of a deltaX number of pixel. If left key is pressed then the circle should move to left of a deltaX number of pixels. The code is:
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.shape.Circle;
    import javafx.scene.paint.Color;
    import javafx.scene.input.KeyEvent;
    import javafx.scene.input.KeyCode;
    import javafx.animation.Timeline;
    import javafx.animation.KeyFrame;
    import javafx.animation.Interpolator;
    var deltaX: Number = 70;
    var direction: Number = 1;
    var tracker: Number = 0;
    var circle: Circle;
    var translate = Timeline {
        def initialValueTracker = tracker;
                keyFrames: [
                    KeyFrame {
                        time: 0s
                        values: [
                            tracker => initialValueTracker
                    KeyFrame {
                        time: 1s
                        values: [
                            tracker => initialValueTracker + direction tween Interpolator.LINEAR
    Stage {
        title: "Application title"
        scene: Scene {
            width: 900
            height:500
            content: [
                circle = Circle {
                    centerX: 100,
                    centerY: 100,
                    translateX: bind tracker*deltaX
                    radius: 40
                    fill: Color.BLACK
                    onKeyPressed: function (e: KeyEvent): Void {
                        if (e.code == KeyCode.VK_RIGHT) {
                            direction = 1;
                            translate.stop();
                            translate.play();
                        } else if (e.code == KeyCode.VK_LEFT) {
                            direction = -1;
                            translate.stop();
                            translate.play();
    circle.requestFocus();I understand how KeyFrame works. However the final value I'd like to be the initial value for next key press. I also tried to assign explicitely the final value to the tracker variable at the end of the timeline, but next time timeline still picks up the initial value 0 of tracker.
    Thanks.

Maybe you are looking for

  • Month View Disappearing Act

    Just recently, when I select month view in the Tiger iCal, the window disappears. I can add new events, but cannot see them unless I'm within the day or week view. Also, when I immediately click day or week, it doesn't fit the frame properly. Does an

  • Can someone help me with a problem of parsing an XML file?

    Hello, I'm having some problems parsing an xml file. I get a SAXNotSupportedException when setting a property value. Here is the piece of code where I have the problem: SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(true

  • Sprting a HashSet by propert

    Hi all, I want to sort a Set by a property that is in the objects of the set. The property is a String. I searched around the net but could find anything that would relate to my problem. Greets

  • Exchange Rate Model By Velu Pillai - error in implementation

    Hello, I have implemented Velu`s example for the "Exchange Rate Model" and made the appropriate modification but when we are dragging the RFC to the iview in the visual composer we get a "Portal Request Fail" error . Did anyone succeeded using this s

  • Testing my movie

    Ok i am testing my movie... when i got to test movie from going to the menu (control---> test movie) my movie works fine... things are moving like they should be and text is being loaded where it should be . (i am actually loading a movie dynamically