How do I set global variables for use by ALL form1.#subform[0] items?

Hi All,
I know how to code javascript but am new to Adobe LiveCycle.  When I open script editor, I have the following code (all code is in un-bolded):
----- form1.#subform[0]::initialize: - (FormCalc, client) ------------------------------------------
// BEGIN: SET GLOBAL PRICES //
var Cityscope_Sydney_CostUser1 = 60.39;
var Cityscope_Sydney_CostUsers2to5 = 3.02;
var Cityscope_Sydney_CostUsers6to20 = 1.21;
var Cityscope_Sydney_CostHardCopyWithOnline = 14.59;
var Cityscope_Sydney_CostHardCopyWithoutOnline = 54.67;
var Cityscope_Sydney_CostHardCopyAdditional = 14.59;
var Cityscope_NorthSydney_CostUser1 = 48.40;
var Cityscope_NorthSydney_CostUsers2to5 = 2.42;
var Cityscope_NorthSydney_CostUsers6to20 = 0.97;
var Cityscope_NorthSydney_CostHardCopyWithOnline = 14.59;
var Cityscope_NorthSydney_CostHardCopyWithoutOnline = 43.54;
var Cityscope_NorthSydney_CostHardCopyAdditional = 14.59;
// END: SET GLOBAL PRICES //
----- form1.#subform[0]::enter: - (FormCalc, client) -----------------------------------------------
----- form1.#subform[0]::exit: - (FormCalc, client) ------------------------------------------------
----- form1.#subform[0]::calculate: - (FormCalc, client) -------------------------------------------
----- form1.#subform[0]::validate: - (FormCalc, client) --------------------------------------------
----- form1.#subform[0]::preSave - (FormCalc, client) ----------------------------------------------
<<======= etc etc etc =======>>
----- form1.#subform[0].Item1Cost::initialize: - (JavaScript, client) ------------------------------
----- form1.#subform[0].Item1Cost::enter: - (FormCalc, client) -------------------------------------
----- form1.#subform[0].Item1Cost::exit: - (FormCalc, client) --------------------------------------
----- form1.#subform[0].Item1Cost::calculate: - (JavaScript, client) -------------------------------
//Store form values in user-friendly names.
var AreaSelected = Item1Area.rawValue;
var NumberOfUsersSelected = Item1Users.rawValue;
//Declare other vars.
var Users1Calculation;
var Users2to5Calculation;
var Users6to20Calculation;
//Calculate individual User Cost "components" based on number of users selected for the area.
switch(true)
case (NumberOfUsersSelected < 2):
  Users1Calculation = NumberOfUsersSelected * Cityscope_Sydney_CostUser1;
  Users2to5Calculation = 0.00;
  Users6to20Calculation = 0.00;
  break;
case (NumberOfUsersSelected > 1 && NumberOfUsersSelected < 6):
  Users1Calculation = Cityscope_Sydney_CostUser1;
  Users2to5Calculation = (NumberOfUsersSelected - 1) * Cityscope_Sydney_CostUsers2to5;
  Users6to20Calculation = 0.00;
  break;
case (NumberOfUsersSelected > 5):
  Users1Calculation = Cityscope_Sydney_CostUser1;
  Users2to5Calculation = 4 * Cityscope_Sydney_CostUsers2to5;
  Users6to20Calculation = (NumberOfUsersSelected - 5) * Cityscope_Sydney_CostUsers6to20;
  break;
default:
  alert("BROKEN: Calculate individual User Cost components based on number of users selected for the area.");
//apply total cost for this item
Item1Cost.rawValue = Users1Calculation + Users2to5Calculation + Users6to20Calculation;
----- form1.#subform[0].Item1Cost::validate: - (FormCalc, client) ----------------------------------
----- form1.#subform[0].Item1Cost::mouseEnter: - (FormCalc, client) --------------------------------
----- form1.#subform[0].Item1Cost::mouseExit: - (FormCalc, client) ---------------------------------
----- form1.#subform[0].Item1Cost::change: - (FormCalc, client) ------------------------------------
----- form1.#subform[0].Item1Cost::full: - (FormCalc, client) --------------------------------------
----- form1.#subform[0].Item1Cost::mouseUp: - (FormCalc, client) -----------------------------------
----- form1.#subform[0].Item1Cost::mouseDown: - (FormCalc, client) ---------------------------------
----- form1.#subform[0].Item1Cost::click: - (FormCalc, client) -------------------------------------
----- form1.#subform[0].Item1Cost::preSave - (FormCalc, client) ------------------------------------
----- form1.#subform[0].Item1Cost::postSave - (FormCalc, client) -----------------------------------
----- form1.#subform[0].Item1Cost::prePrint - (FormCalc, client) -----------------------------------
----- form1.#subform[0].Item1Cost::postPrint - (FormCalc, client) ----------------------------------
----- form1.#subform[0].Item1Cost::preSubmit:form - (FormCalc, client) -----------------------------
----- form1.#subform[0].Item1Cost::docReady - (FormCalc, client) -----------------------------------
----- form1.#subform[0].Item1Cost::docClose - (FormCalc, client) -----------------------------------
----- form1.#subform[0].Item1Cost::ready:form - (FormCalc, client) ---------------------------------
----- form1.#subform[0].Item1Cost::ready:layout - (FormCalc, client) -------------------------------
----- form1.#subform[0].Item1Users::initialize: - (FormCalc, client) -------------------------------
----- form1.#subform[0].Item1Users::enter: - (FormCalc, client) ------------------------------------
----- form1.#subform[0].Item1Users::exit: - (FormCalc, client) -------------------------------------
----- form1.#subform[0].Item1Users::calculate: - (FormCalc, client) --------------------------------
----- form1.#subform[0].Item1Users::validate: - (FormCalc, client) ---------------------------------
----- form1.#subform[0].Item1Users::mouseEnter: - (FormCalc, client) -------------------------------
----- form1.#subform[0].Item1Users::mouseExit: - (FormCalc, client) --------------------------------
----- form1.#subform[0].Item1Users::change: - (FormCalc, client) -----------------------------------
----- form1.#subform[0].Item1Users::full: - (FormCalc, client) -------------------------------------
----- form1.#subform[0].Item1Users::mouseUp: - (FormCalc, client) ----------------------------------
----- form1.#subform[0].Item1Users::mouseDown: - (FormCalc, client) --------------------------------
----- form1.#subform[0].Item1Users::click: - (FormCalc, client) ------------------------------------
----- form1.#subform[0].Item1Users::preSave - (FormCalc, client) -----------------------------------
----- form1.#subform[0].Item1Users::postSave - (FormCalc, client) ----------------------------------
----- form1.#subform[0].Item1Users::prePrint - (FormCalc, client) ----------------------------------
----- form1.#subform[0].Item1Users::postPrint - (FormCalc, client) ---------------------------------
----- form1.#subform[0].Item1Users::preSubmit:form - (FormCalc, client) ----------------------------
----- form1.#subform[0].Item1Users::docReady - (FormCalc, client) ----------------------------------
----- form1.#subform[0].Item1Users::docClose - (FormCalc, client) ----------------------------------
----- form1.#subform[0].Item1Users::ready:form - (FormCalc, client) --------------------------------
----- form1.#subform[0].Item1Users::ready:layout - (FormCalc, client) ------------------------------
...and so on and so forth....
In short, I want the code within:
----- form1.#subform[0].Item1Cost::calculate: - (JavaScript, client) -------------------------------
...to be able to access the variables I have created in:
----- form1.#subform[0]::initialize: - (FormCalc, client) ------------------------------------------
(I have assumed that this is where I would store Global variables)
At this stage, the global variables cannot be accessed with the configuration above.  The only was I can get this to work is to cut and paste the global vairables into each form1.#subform[0] item, which of course defeats the purpose of global variables!  I plan to have many more items so would not want to duplicate the global variables for all of them!
Can somebody show me how to do this?
Any help is very much appreciated!
Thanks
Stanbridge
Message was edited by: stanbridgej - colors and or fonts won't save.  Have bolded my question to make code (non-bolded) easier to read (I hope).

Hi MorisTM,
Thanks for the reply!
Yes, I saw that option (I should have mentioned I already knew about it), but was wondering if there is a way I can do this via code.
There are two reason I want to be able to do it via code (only one of which may be valid):
1) I can automatically generate my pricing code form another inhouse app.
2) I am hoping that later on once I get this working I will be able take it a step further and get the data directly from a MySQL database!
Cheers though!
Any other suggestions?
Regards,
Stanbridge

Similar Messages

  • Pass the value of the current case in a case structure to a global variable for use in VIs.

    I have built a large queued state machine (>100 cases).  In each state, I run a VI that I have created.  These VIs are usually not very different from one another.  In many cases, I could simply use the same VI over and over again.  There is only one problem with that.  None of these VIs know which case to send the program to next.  I have to change the value of the "NEXT_CASE" constants in the VI and save it under a new name to be inserted into each new case.  Now my program consists of hundreds of VIs whose only difference is the value of their "NEXT_CASE" constants.  This causes all kind of headaches when I have to insert new cases into the state machine, and it is just too much for me to deal with.
    I need to be able to use a global variable to keep track of the current case within my VIs.  I could change it from a string to a number and add or subtract from it to determine which case the program should go to next.  Since I'm usually only skipping from one case to the next (or the previous) I could use the exact same VI in most cases.  Can anyone tell me how to create a global variable that contains the value of the case in my case structure that I could use within my VIs to keep track of the current case?  Let me know if you have any questions.

    Instead of defining the next state inside the subvi, why not do it in the main vi inside each state case?  An output from the subvi could be used with a case structure to determine the next state.  Sort of like, if the subvi returns 0 then next state is State3, else if the subvi returns 1 then next state is State4.
    Message Edited by tbob on 08-19-2005 03:15 PM
    - tbob
    Inventor of the WORM Global
    Attachments:
    NextState.PNG ‏5 KB

  • How can I set up iPad for use as a customer sales tool?

    I want to use my new iPad for personal and business. For my business I want to hand to a customer as a self-driven presentation on my business created In Keynote or some similar program. But I'd like to lock all personal content so the customer can only explore my business content and not access personal contacts, music, etc. Can this be done? Recommendations on apps and set-up are appreciated.

    Can't be done. All the customer has to do is press the home button and they're able to access all your apps.
    You either need different iPads for different purposes, or mount it in a display cabinet that blocks the home button.

  • How to define a global field for use in User exit

    Hi All,
    I want to define a global flag field (say my_flag) in Function group VEDA. I need to set/reset it in exit EXIT_SAPLVEDA_003 and check its value in EXIT_SAPLVEDA_002.
    Can anyone help me out in this. Where can I define this field?
    Thanks.
    Regards,
    Riyaz

    I have created a customer table zflag1 which has one field z_flag and the correspopndiong data el;ement is 'zflag' and i also ccreated parameter ID in table TPARA and assigned tht parameter ID 'ZFLAG' to my data element.
    reward points if helps..
    in the Z include of Exit function 3 write -
    data :g_global like zflag1-z_flag.
    G_GLOBAL = 'X'.
    set parameter id 'ZFLAG' field g_global.
    and in the Z include of exit function 2 write  -
    DATA G_GLOBAL LIKE ZFLAG1-Z_FLAG.
    GET PARAMETER ID 'ZFLAG' FIELD G_GLOBAL.

  • Set Global Properties for ADF components

    Hi everyOne....
    My question is the following .... let me know how I can set global properties for a component and not have to set the same property in each of them.
    Thanks
    Edmar

    Let me know if this answers your question:
    For Attributes : set the properties in EO or VO. [You can set all UI properties too]
    For labels: use Resource bundle
    For Layout Components to set the look and feel. CSS/Skinning would be the best.
    I guess this should cover most part of application.
    Amit

  • How do I set time limits for my iphone?

    You know how there are parental controls on the macs in the settings. In there you can set up time limits of how long you can use the computer for but I can't find it on the iphone where you can set time limits for use. I looked at the restrictions sections but I don't see anything on setting time limit. How could I set time limits for use on my phone? I go on my phone too much and I really have to set restrictions to limit my time on it.

    There are apps you can download i believe to do this.
    https://itunes.apple.com/us/app/parental-timelock-time-limit/id689577280?mt=8
    for example

  • How to use a global variable for reading a query resultset in JDBC lookup?

    Hi Friends,
    Using JDBC lookup, I am trying to read from a table Emp1 using a user defined function. In PI 7.0, this function returns values of a single column only even if you fire a " Select * " query. I am planning to use a global variable(array) that stores individual column values of the records returned by a "select *" query. Need pointers on as to how a global variable can be declared and used to acheive the above scenario. Kindly explain with an example. Any help would be appreciated.
    Thanks,
    Amit.

    Hi Amit,
    Sounds like a good idea but then you would need an external db and update the table in a thread safe way !.
    Regarding your question as to how to work with global variable please refer https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/1352. [original link is broken] [original link is broken] [original link is broken]
    Rgds
    joel

  • How can I define global variable in user exit whic I can use anywhere.

    Hi all,
    How can I define global variable( Table ) which I can use when it come back to same user exit where I defined and stored some data.
    What I mean is I want to define 1 global table.
    In user exit when it comes I store some information. and again when it will come I will have that stored information so I can use it.
    Thanks a lot in advance.

    You can use EXPORT  TO MEMORY ID and IMPORT FROM MEMORY ID Statement for this.
    EXPORT T_ITAB FROM T_ITAB TO MEMORY ID 'ABC'.
    IMPORT T_ITAB TO T_ITAB FROM MEMORY ID 'ABC.'

  • How to set enviroment variables for Inso Filter

    Hi everyone,
    I want to convert word documents to html using CTX_DOC.Filter.According to the documentation,I know I neednot set the 'Inso Filter'in the preference when creating index,but I must set enviroment variables for Inso Filter.
    I found the following instructions for it in the 8.1.5 documentation,but I can't understand it well.Is there anyone can tell me how to set enviroments variables for Inso Filter on Windows2000 Server?(My DB version is 8.1.7EE)
    Environment Variable Locations
    All environment variables related to Inso filtering must made visible to interMedia Text. Set these variables in the following locations:
    listener.ora file. This makes the environment variables visible to the extproc PL/SQL process.
    The operating system shell from where ctxsrv server is started. This makes the environment variables visible to the ctxsrv process, which does background DML.
    Any suggestions are apreciated
    Reemon
    null

    NSAPI plugins are normally configured using parameters specified in magnus.conf and/or obj.conf. What plugin requires you set an environment variable?

  • Use global Variable for Formatstring

    Hello
    I wanna use a global variable for a format string. see picture. But I don't work.
    Can anybody give me an idea, why it won't work?
    Thanks a lot!!!
    Attachments:
    GlobalVariable.jpg ‏61 KB

    As others said, the problem is not the global.
    See attached a picture of how to do what you want. Since the Format String is unknown at edit time, you must provide the types to all inputs that are not DBL.
    From your example, the while loop has been coded exactly like a for loop. It can be replaced with a for loop with auto-indexing, unless you really want the local variable to be update at each iteration every 50 ms. This delay is not necessary unless the computed array is huge and you want to leave some CPU time to other code in your application. Even then you can enter a delay of 0ms to force to swap to other tasks.
    I don't know what your INT>BOOL VI does but using Scan from String you can read a number directly into a boolean. The number i
    s rounded to an unsigned integer and 0 is False and >0 is True.
    For example you scan a string for a boolean with format string %d.
    "0" --> False
    "24" --> True
    "-18" -- False (coerced to unsigned = 0)
    You scan a string for a boolean with format string %f:
    Negative number up to "0.5" --> False (coerced and rounded to 0)
    Number greater that 0.5 --> True
    LabVIEW, C'est LabVIEW
    Attachments:
    diag.jpg ‏15 KB

  • I am setting up ipads for use in an elementary, and I would like the "home screen" to be the apps, rather than the default with the chat, mail, etc icons.  how do I change that?

    Can anyone answer this question?
    I am setting up ipads for use in an elementary, and I would like the "home screen" to be the apps, rather than the default with the chat, mail, etc icons.  how do I change that?

    Depending on exactly what you want to do, there are a couple of ways of handling this. You may want to access teh user guide for some ideas: http://manuals.info.apple.com/en_US/ipad_user_guide.pdf
    In particular, check the sections on Customizing iPad and Settings > Restrictions.

  • How to set bind variable for a VO ,

    Hi,
    i got a requirement in which i have to set bind variable for VO , But the Bind variable is coming from payload attribute,
    For example my query in VO is select * from Employee where emp_id="payload attribute"
    How to set this attribute value is from the payload
    Thanks Regard
    Rajendar

    Hi i am getting this exception " Cannot create an object of type:java.lang.Number from type:oracle.bpel.services.datacontrol.data.DataObject with value:21159"
    Actually i am getting Decimal Value from Payload of BPEl process and i am trying to set this to The bind variable
    is that a type cast exception where can i typeCast Those values You should this in a new thread.Dont ask questions out of the scope of this thread.
    Please mark this thread as answered or helpful if you got solution for this thread.
    Thanks!!!

  • How do I cut and paste sets of lines for use in various Math questions?

    How do I cut and paste sets of lines for use in various Math questions?

    Thank you for your reply. My problem is much simpler than you are thinking. As a teacher I prepare sheets with random number generators.
    EG. 256 + 389= ______    or         467
                                                 -  384
           469 + 753= ______     
    or  5)750
    On a PC I was able to start a page of A4 with one set and then drag and drop down and across the page.
    On my Macbook I can get the numbers in but the lines do not copy. I asked at one of my One to One sessions and it had my 'trainer' stumped. He said he would make enquiries but so far no news. I am using Numbers.
    I hope I have explained my 'problem' satisfactorily.

  • How to set bind variables for child VO in hierarchy component?

    Hi,
    Recently I created a application with Hierarchy Component with Parent VO (Query based VO with Bind variables in it) and its Child VO along with Child-Child VO(Query based VO with bind variable in it)
    I am able to set bind variable of parent VO but unable to set bind variable for Child-Child VO. Can any one help me regarding this issue?

    Hi i am getting this exception " Cannot create an object of type:java.lang.Number from type:oracle.bpel.services.datacontrol.data.DataObject with value:21159"
    Actually i am getting Decimal Value from Payload of BPEl process and i am trying to set this to The bind variable
    is that a type cast exception where can i typeCast Those values You should this in a new thread.Dont ask questions out of the scope of this thread.
    Please mark this thread as answered or helpful if you got solution for this thread.
    Thanks!!!

  • How can I access global variables in a loaded Applescript?

    How can I access global variables in a loaded script, in Xcode, ApplescriptObjC? Basically, I have a global variable defined in my parent script using "property", and I need to modify objects connected to those variables inside of a loaded script.
    Example:
    Parent script:
    script AppDelegate
    property myTextField : missing value
    //linked to a text field object
    tell myScript to myAwesomeHandler_()
    end script
    Loaded script:
    on myAwesomeHandler_()
    myTextField's setStringValue_("The new Xcode is so glitchy ugh")
    //changes value of linked text field of parent script
    end myAwesomeHandler_
    The problem is, the variable is undefined in the Loaded script, and I need it to have the same value as the parent script, and I don't want to pass the variable through the Handler. Any ideas?

    I think want you are looking to do will need to be done in two steps. Because myTextField needs to be a property for the ObjectiveC part of the code you cannot turn it into a global.
    However if you make a temporary variable global assign the string to it in the handler then set myTextField off of it.
    global myTextFieldGlobal
    script AppDelegate 
    property myTextField : missing value 
    //linked to a text field object 
    tell myScript to myAwesomeHandler_() 
    myTextField's setStringValue_(myTextFieldGlobal)
    end script 
    on myAwesomeHandler_() 
    set myTextFieldGlobal to "The new Xcode is so glitchy ugh"
    //changes value of linked text field of parent script 
    end myAwesomeHandler_ 
    I know you stated you did not want the handler to return a value but I have to ask why? Global's, imo, are not a good idea and really should be used as a last resort.
    One other possibility is to pass a reference to the property to the handler. Not sure if that works in AS of if that would satisfy our requirement of not passing the variable through the handler
    <edit>
    Another though have you tried to define the property outside the script?  That is
    property myTextField : missing value
    script AppDelegate
    Not sure if that will work.
    You might also want to have a look at Scope of Properties and Variables Declared in a Script Object

Maybe you are looking for

  • Triggering a sub work flow for multiple users at same time.

    I have a scenario in which I have created sub workflow as an activity for approval process. This sub work flow should be triggered for multiple users at the same time and their decison is independent of each other. This is like creating multipe insta

  • Pickup the file based on the date in file name

    Dear all, I have requirement like this. EX: I have file name called ABC_20110721.txt , i have to pickup that file today and should not delete it and should not mark as 'Read only'. We have to keep that file as is in FTP. I will have another file tomo

  • D11.5 Projector gets stuck on encountering first sound file

    My projector runs fine on my PC (where I have D11.5) but when pack up all the files and try to play it from a new machine, the projector plays the opening screen and as soon as it has to make the first sound, it freezes. It seems as if it can not fin

  • Com.sun.faces.saveStateFieldMarker after upgrading to JSF 1.1_02

    After upgrading from JSF RI 1.1_01 to 1.1_02 , "com.sun.faces.saveStateFieldMarker" is displayed at the bottom on my jsf-page. I scanned the forums and found some threads about this. However, I haven't found a proper solution to the problem. Any idea

  • [SOLVED] Patch For Openbox In Repos Needed

    I just experienced a crash in openbox due to java. This fix works (scroll to last reply): https://bbs.archlinux.org/viewtopic.php?id=130654 I just realized that when I updated to "3.5.0-5" a while back this had still not gotten fixed. I tested the sa