Announcement

Collapse
No announcement yet.

Where is the best place to initialise global variables

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Where is the best place to initialise global variables

    i have an application that is automatically opened when the menu loads. However am getting this message:
    The following global variables are missing

    Even when i do initialize these global variables to zero at these events: OnScriptInit (using sc_reset_global)

    on the onload event i initialise the two globals to a certain value (sometimes zero)

    either way, i still get the message The following global variables are missing

    any help or idea on what to do?

  • #2
    If you go to application -> global vars you can set the variable to in or out. If the variable is out then the app is supposed to create it and on testing the application SC will not ask for the values. Personally I hate the fact that you can create globals everywhere causing a mess in 'overviewability'. After all, if you rely on a global somewhere but the application creating it is not called you get obscure error messages. I'm not saying this is the best solution, but for me best practice to declare each and every global variable in my initial application, useually called 'main'.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Originally posted by aducom View Post
      [...] but for me best practice to declare each and every global variable in my initial application, useually called 'main'.
      I agree, but i call it "autostart" . But, i use only a few global vars, usually I take session variable, this can I better structure ([myapp][user][user_name], [myapp][grid_customer][rows] etc.).
      Best regards: - Reinhard -

      I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

      Comment

      Working...
      X