Announcement

Collapse
No announcement yet.

Setting global variables in events

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

  • Setting global variables in events

    I have a filter application to set a default company and a person of that company. I have a caption link on both fields. I select the company from the link and set the global_comp variable. Then I use the person link and it doesn't show me the selected company, but those of the old global_comp. I can force this by setting a sc_redir to the same application in the ajax event onchange on the current field. Then clicking on the person link will show me the persons of the selected comp.
    I use the global variables throughout the project. It appears that setting a global variable is local until you let things go through te control of the project?
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

  • #2
    Hi Albert,
    I am in SCV7.1 eval and in a menu app, onLoad event, I am able to make a local var from a DB table value and make it global: [glo_color] = $inHeaderColor;
    The [glo_color] works in the same event, lower down in the code. Are you setting the global like I did or with the macro? The reason I ask is that I just noticed that in the v7.1 web help, the macros is deprecated soon... don't know of that has any effect. Wow, now that I have installed the v7.1 eval, and trying things, I am surprised by the number of issues still floating around! I still have my main projects in v6
    Jamie

    Comment


    • #3
      Hi Jamie,

      My problem is that I want to 'guide' my customer through the application. It's a medical dossier. The user selects the medical dossier. The application 'sees' that it's missing the person number and company. So it redirects to a filter application to select the company and patient. This filter application has two caption links to select the company and one to select the person of that company. The data is passed using global variables in the [var] style. If I select a company then the company id is added to a global : [glob_comp]={myselectedcomp}. Then I hit the caption link of the person. This grid is selecting all data using [glob_comp]. But it's the [glob_comp] of the original value. So once assigned in the filter application the scope is not project wide. But if I do a sc_redir to the filter application after assigning the global then it does work. So the sc_redir or 'ok' button is the trigger to get the global data pushed through to the rest of the application. I've set this variable to be of a session type but that didn't help too. So I managed to work around it by using the sc_redir, but I think there should be a more logical solution to this.
      Albert Drent
      aducom software netherlands
      scriptcase partner, reseller, support and (turn-key) development
      www.scriptcase.eu / www.scriptcase.nl

      Comment


      • #4
        Hi Albert
        did you solve your problem? I have exactly the same problem: My global var has everytime the old value. I set it on_change event of a select field. But when i Message it out, it has the value form the previous form load.... How can i do?

        Comment


        • #5
          Yes, I managed as I described. See other post regarding the exchange of global variables. You can try to set the global variable to type session.
          Albert Drent
          aducom software netherlands
          scriptcase partner, reseller, support and (turn-key) development
          www.scriptcase.eu / www.scriptcase.nl

          Comment


          • #6
            Hi Albert
            i read all this threads, but you also write above:
            I've set this variable to be of a session type but that didn't help too.
            What i did:
            On_change from my select field "number":
            [global_number]={number}

            Then i checked in "Global Variables" only "Session", Post and Get i disabled.

            In the receiving form i get everytime the previous value, not the latest. Have you any idea?

            Best regards
            Steve

            Comment


            • #7
              No, then you have to try my way with the sc_redir.
              Albert Drent
              aducom software netherlands
              scriptcase partner, reseller, support and (turn-key) development
              www.scriptcase.eu / www.scriptcase.nl

              Comment

              Working...
              X