Skip to main content
Known Participant
March 16, 2007
Question

Global Variables

  • March 16, 2007
  • 2 replies
  • 449 views
Im having trouble understanding where I put code exactly. Can I have global variables with serverside script?

When I create a variable outside of any functions it doesnt seem to be able to be read from within application functions (like application.connect). Can anybody point me in the right direction of understand how this whole dynamic works?
    This topic is closed to new replies. Start a new post to keep the conversation going.

    2 replies

    Inspiring
    March 16, 2007
    Hello :)

    you can use the _global in SSAS ... it's easy


    in the main.asc :

    _global = this ;

    and now you can use this scope reference to call the global target when
    you want.

    All class in SSAS must be implemented in the global scope. The _global
    scope it's the root environnement of the main.asc file.

    For me it's a bad idea to override the application object with all the
    global methods...

    EKA+ :)

    JayCharles a écrit :
    > I seem to remember reading something about the FMS Framework using _global for
    > specific purposes (don't remember exactyl what it was), and therefore using
    > _global elsewhere wasn't recommended.
    >
    > I like to assign variables to the application object (FMS creates the
    > application object for you when the app starts) when I need a global var.
    >
    > application.myVar = "someValue"
    >
    > Now you can reference that application var from anywhere in your SSAS by using
    > application.myVar
    >
    March 16, 2007
    I seem to remember reading something about the FMS Framework using _global for specific purposes (don't remember exactyl what it was), and therefore using _global elsewhere wasn't recommended.

    I like to assign variables to the application object (FMS creates the application object for you when the app starts) when I need a global var.

    application.myVar = "someValue"

    Now you can reference that var from anywhere in your SSAS by using application.myVar