Declare global variable and retrive?

Hi,
we are working in live project in webtool, we wants to create global variable,
calling that variable in a required pages, our questions is that where to declare global variable and how to declare in which page we have to declare?   pls guide us its very urgent and send the code.
Regards
Kannan.D
Edited by: kannan desikan on Jan 14, 2008 8:07 AM

Hi Kannan,
I would suggest using a comma delimied list or putting it in the database.
ArrayList myList = new ArrayList();
myList.Add("one");
myList.Add("two");
myList.Add("three");
string comma = "";
// store the array in the session state
foreach (string s in myList){
  Session["persistedArray"] += comma + s;
  comma = ",";
To get the array back
if (Session["persistedArray"] != null){
  ArrayList myList = Session["persistedArray"].ToString().Split(new char[1] {','});
If your array is storing objects, you should use the database.

Similar Messages

  • How to declare global variables using another global variable in ODI

    I am declaring a gloabal variable using another global variable.
    say for example:
    I have a global variable empid.
    I am decalaring another global variable empname in refreshing tab of global variables and the select statment is
    select empname from emp where empno = #GLOBAL.empid -------if i write like this i am getting error as invalid character.
    select empname from emp where empno = '#GLOBAL.empid'-------if i write like this i am getting error as invalid number.
    I have kept the datatype as numeric and action as non persistent
    Please help
    Thank you in advance.

    Hi,
    You cant test/refresh empname standalone.
    You need to create a new package drag and drop both variables and make them as refresh variable and execute that package and test.
    Flow,
    empid----> empname
    Thanks,
    Guru

  • What's the difference between global variables and instance variables?

    hi im just a biginner,
    but what is the difference between these two?
    both i declare them above the constructor right.
    and both can access by any method in the class but my teacher said
    global variables are not permitted in java....
    but i don't know what that means....and i got started to confuse these two types,,
    im confusing.......
    and why my teacher said declaring global variables is not permitted,,,,,,
    why.....

    instance variables are kindof like Global variables. I'm not surprised you are confused.
    The difference is not in how they are declared, but rather in how they are used.
    There are two different "styles" of programming
    - procedural programming.
    - object oriented programming.
    Global variables are a term from Procedural programming.
    In this style of programming, you have only one class, and one "main" procedure. You only create one instance of the class, and then "run" it.
    There is one thread of control, which goes through various methods/procedures to accomplish your task.
    In this style of programming instance variables ARE "global" variables. They are accessible to all methods. There is only one instance of the class, and thus only one instance of the variables.
    Global variables are "bad" BECAUSE you can change them in any method you like. Even from places that shouldn't have to. Also if you use the same name as a global variable and a local variable, you can cause great trouble. This can lead to very subtle bugs, as the procedures interact in ways you don't expect.
    The preferred method in procedural programming is to pass the values as parameters to the methods, and only refer to the parameters, and local variables. This means that you can track exactly what your method is doing, and what it affects. It makes it simpler to understand. If you use global variables in your methods, it becomes harder to understand.
    So when are instance variables not global variables?
    When you are actually using the class as an Object, rather than just a program to run. If you are creating multiple instances of an object, all with different values for their instance variables, then they are not global variables. For instance you declare a Person object with an attribute "firstname". Your "main" program then creates many instances of the Person object, each with their own "firstname"
    I guess at the end of all this, it comes down to definitions.
    Certainly you can write procedural code in java. You can treat your instance variables, for all intents and purposes like global variables.
    I can only think to show a sort of example
    public class Test1
       User[] users;
       public void printUsers(){
         // loop through and print all the users
         // uses a global variable
          for(int i=0; i<users.length; i++){
            users.printUser();
    public void printUsers(User[] users){
    // preferred method - pass it the info it needs to do the job
    for(int i=0; i<users.length; i++){
    users[i].printUser();
    public Test1(){
    User u1 = new User("Tom", 20);
    User u2 = new User("Dick", 42);
    User u3 = new User("Harry", 69);
    users = new User[3];
    users[0] = u1;
    users[1] = u2;
    users[2] = u3;
    printUsers();
    printUsers(users);
    public static void main(String[] args)
    new Test1();
    class User{
    String firstName;
    int age;
    public User(String name, int age){
    this.firstName = name;
    this.age = age;
    public void printUser(){
    // here they are used as instance variables and not global variables
    System.out.println(firstName + " Age: " + age);
    Shit thats a lot of typing, and I'm not even sure I've explained it any good.
    Hope you can make some sense out of this drivel.
    Cheers,
    evnafets

  • How do I store VI References in global variables and access them later

    From what I know, Labview automatically deletes VI references when they go out of use. Is there a way for me to override this so that I can access a set of preloaded references in a separate VI? Essentially I would like to open the VI's dynamically into the memory, store the references in global variables and access them at a later time. The VI's I'm referencing won't be known until runtime. I know its not the safest way to do it, but it would be the most productive on my end.
    Thank you
    Clay Upton

    I'm not sure what you mean by "a later time", but a VI reference will remain valid as long as the VI is in memory. If you don't unload the VIs, the references will remain valid.
    If you do need to unload the VIs, for whatever reason, I would suggest the following:
    Create a functional global as your interface for obtaining the references.
    Feed the paths to the VIs into the VI when initializing it (since you don't know which VIs in advance).
    When calling the VI to obtain the references, have the VI check them first (using the Not a Number... primitive). If it sees that they're invalid, it can open a new reference and return that.
    You should note that when a VI is removed from memory, the data space is used is released, so if those VIs are expected to hold data (using shift registers, etc.) this will be a problem.
    The description I've given will only be usable in certain instances (and it has its intricacies), but you didn't really give any details about what you're actually trying to accomplish.
    Try to take over the world!

  • How can i find all global variable and parameters in a form?

    I don't know name of global variables and parameters,but i want get their name and value .
    how can i do? who can help me?
    Thank you.
    Daniel Liang
    2007.1.19

    no problem. As Francois said you can't do it programmatic in runtime.
    But when you use the debug-mode you can see each global with name and value.
    By the way: It's not good to not know all the globals in your application. This is one of the most important things you have to write down for your app. Create a wiki for such informations, so that all developer can share their information.

  • Syntax for declaring global variable in report

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

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

  • APEX: Declare global variable in APEX

    Hello All,
    Can anyone tell me how to declare global variable in Process(Pl/sql code) in Oracle APEX.
    Thanks,
    Jiten

    There is nothing like Global Variable that can be declared in Process in Apex.
    Look up Shared Components > Application Item. Maybe that is something that meets your requirement.
    Alternate, use Page 0 items.
    Regards,

  • Oracle Froms, Global Variables and Oracle Reports

    Hi all,
    We are developing a form that will call an Oracle report and we would like to test the value of a global variable that was set in the Oracle Forms in the "Before Parameter Form" in the Oracle report trigger. Can this be done?
    Thanks, Larry

    The "global" var. is global to either a report or a form, not both. You may pass them from one to the other but that's not the session-global thing.
    DC

  • Global variable and timer

    Hi,
    I have a really amazing problem. I have a form with a when-new-from-instance-trigger. In this trigger I create a timer. The timer reads some information and should pass them to a global variable. For testing my form I pass additionally the global variable value to a text object. After the timer I want to use the global variable value for a where condition in a sql statement. But I get always the no_data_found exception and the value of the global variable is empty! What happens with my value? Does anybody know about such a problem? Please help.
    Thanks Mandy

    My question is, why are you starting a timer from a When-new-form-instance trigger? If all you are doing in the when-timer-expired trigger is some SQL lookup, why don't you do it directly in the when-new-form-instance trigger?
    Timers, no matter how short a time span, do not expire (and run the when-timer-expired trigger) until everything else is done, and control switches to the user (form is ready to accept user input from mouse or keyboard). The only exception is in web forms where you start a timer with 0 (or maybe 1, I don't remember) millisecond -- in that case, Forms runs the when-timer-expired code immediately.

  • Webdynpro - how to add global variables and common proj to existing proj

    How to add global variable in either ViewController or CustomController.  We realise that codes must be added within the begin and end exction.  Codes outside that will be deleted when saved. 
    How can we add a common WDP project to an existing project?  We have actually added a common wdp project at the project references screen.  But during runtime, we encouter error.  The error is classNotFoundException.  The class is the class created in the common project.

    Hi.
    I think you need to assign ProB to ProA.
    Step1.
    Open propety of ProjectA.
    Step2.
    Select WebDynproRefrences
    Step3.
    Select Sharing references
    Step4.
    Choose add button.
    Step5.
    If your projectA named "testapp" and you are not using
    DC "local/testapp" is the proper name.
    I hope that it work!!!.

  • Newbie thread about global variables and result set

    Hello everyone this is my first post, im from colombia and now im learning about this world !! the WCC !!
    Now im doing a practice but im so noob that i cant get it so far... i wrote some of the oracle documentation.. and it was so usefull for starting.. but now im trying to do custom components builded in java + resources + services + template etcc .. all good stuff :D.
    i want to retrieve a result set coming from a custom service ... and then i want to store this result set in some kind of global variable !! why ? because i want to use this data from the result set again and again without making more call to the service !!
    ive tried to copy this resultset but i think it cant be done because i use a popUp window to display the rows from the RS.. and when i close the window .. it dies!!
    i want to use this RS for 3 custom metadata field.. but i have no idea how to do this....
    this is a part of my custom resource
    <$if fieldName like "xElaborador"$>
    <$executeService("SERVICE_ALLUSERS")$>
    <$trace(" ### executing service ###","#log")$>
    <!--i tried to copy the rs here but this is wrong i guess -->
    <$nuevoRS="usuarios_LDAP"$>
    <$endif$>
    <!-- usuarios_LDAP is the RS parameter coming from the java calss -->
    <$if rsExists("usuarios_LDAP")$>
    <$if rsFirst("usuarios_LDAP")$>
    <$loop usuarios_LDAP$>
    <$trace(" ### inside RS ###","#log")$>
    <$include each_user_LDAP$>
    <$endloop$>
    <$else$>
    <$include therearenotusers$>
    <$endif$>
    <$endif$>
    <!-- THIS CODE IS USELSS BASICALLY-->
    <$if fieldName like "xRevisor"$>
    <$if rsExists("nuevoRS")$>
    <$if rsFirst("nuevoRS")$>
    <$loop nuevoRS$>
    <$trace(" ### inside rs for revisor ###","#log")$>
    <$include each_user_LDAP$>
    <$endloop$>
    <$else$>
    <$include therearenotusers$>
    <$endif$>
    <$endif$>
    <$endif$>
    pls tell me if im too lost im all ears to learn the good practices for this tool.

    Hi ,
    One of the good resource on this topic is :
    http://jonathanhult.com/blog/2012/11/resultset-versus-dataresultset/
    Thanks,
    Srinath

  • To declare global variable in enhancement Spot

    I have added 3 field which contain leave details of previous month in pe51 form and in enhancement spot FILL-ZK-MOD in Standard payslip progeam HINCEDT0 and  added code to calculate the leaves in this varaibles. now i require to display data of this variables on payslip.this varaibles are local to that enhancement hence could not able to access on form.
    if i can declare this varaible as global. is there any solution to this.

    Hi,
    Go to the include RPCEDDZ9 ...where you can declare.
    Thanks,
    Shailaja Ainala.

  • 10g declare :global variable error (bad bind variable)

    In a 10g form, I tried this code in the pl/sql block and in the spec of a library package
    begin
       :global.config := 'x';
    ...upon compile, I get an error
    "bad bind variable"
    ...encountered the symbol "GLOBAL" when expecting one of the following...It doesn't like :GLOBAL.variablename := 'x';
    What am I doing wrong?
    Thank you.

    globals are allowed in librarys, but in libraries you have to use COPY and NAME_IN to access objects you access via :-logic in forms-modules, e.g. setting the global would be like
    COPY('X', 'GLOBAL.CONFIG');Edited by: aweiden on 29.10.2008 19:33

  • Global Variables declaration in PI 7.1

    Hi All,
    In message mapping where can I declare global variables in PI 7.1.
    Thanks and regards
    Uma

    Hi Sarvesh,
    Thank you for the response.
    The blog given by you is on PI 7.0, But icon(Java Sections) is not present in PI 7.1 mapping editor .
    Please guide me how can I proceed further.
    Thanks & regards
    Uma
    Edited by: Uma Balasubramanya on Mar 20, 2009 1:11 PM

  • Apex- global variable declaration

    Dear Friends
    I am very new to Oracle applicaiton express,
    Please let me how to declare global variable in an applcation. The variable should be accessible throught ot all the pages in that applicaion. Any one can help?

    Hi,
    use an application item for that purpose.
    Just navigate to Shared Components->Application Items and create what you need.
    Regards,
    Moritz

Maybe you are looking for

  • HOW TO PRINT THE SCRIPT DIRECTLY

    hi , i want to print the script directly by skiping the prini preview screen can any one help me.. regards, siva

  • Can't re-install 1.3

    Due to slow Safari browsing issues (link below if interested), I reinstalled/downgraded to 1.2. I've since tried to reinstall 1.3 (either 1.3.1 or 1.3.2) with no luck. It doesn't show up in Software Update. I also download the updater which seemed to

  • Photoshop CC slow with Yosemite

    Just got a new Macbook and Yosemite. Migrated my old stuff over. Photoshop was unbearably slow. Apple helped me a little getting rid of artifacts from old  system and versions of Photoshop, but it's still really slow. 2012 Macbook Pro, 4 GB ram. Any

  • Lock records in non-db blocks....

    Hi, I make a test: Run the same form twice - as two users would do - and try to update the same record almost simultaneously .. then a row lock is established - as expected. I try another test: Run the same form twice - as two users would do - and tr

  • Will Logic Studio AUs run in Logic Express 9

    I have Logic Studio 8, with tons of additional AUs that I purchased. I am thinking of purchasing Logic Express 9, and was wondering if the AUs from Logic Studio will work in Logic Express 9. Also, I hear, (but am not sure) that  Logic Express doesn't