Access to global.ini variables

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Access to global.ini variables

  • Creator
    Topic
  • #55649
    Mark Thompson
    Participant

      Cloverleaf 6.2 adds a Global Variables tool and makes the variables available in Xlates, NetConfig, etc.   Does anyone know how to access these “global” variables from Tcl?  Documentation says there is an API available, but I haven’t found it.

      Code:

      >cat $HCISITEDIR/AppDefaults/globalVariables.ini
      [myGlobalVar]
      value=abc
      encrypted=0

      hcitcl>global myGlobalVar
      hcitcl>echo $myGlobalVar
      Error: can’t read “myGlobalVar”: no such variable
      hcitcl>echo $$myGlobalVar
      Error: can’t read “myGlobalVar”: no such variable

      - Mark Thompson
      HealthPartners

    Viewing 2 reply threads
    • Author
      Replies
      • #86011
        Rob Abbott
        Keymaster

          Hi Mark,

          We missed this in the documentation.  It will be updated in the next release.

          The GV’s work more like a Table lookup than Tcl global variables.  Here are the GV commands:

          gvsubstring

          Load INI file, after verify the variable names, save each pair of variable name and value to hash map in memory

          gvsubfile

          Save the variable table in memory to INI configure file

          gvaddvar

          Add the variable name and value to the table

          gvdelvar

          Delete a variable from the table

          varName(In)

          Rob Abbott
          Cloverleaf Emeritus

        • #86012
          Mark Thompson
          Participant

            Thanks Rob – very helpful.

            Is there a way to directly access the hash map (possibly as an array or dict)?  Or do I need to parse gvprint to see the entire list of available gv’s?

            - Mark Thompson
            HealthPartners

          • #86013
            Rob Abbott
            Keymaster

              I don’t think there is.  I will submit the following enhancement request:

              – add a way to load GVs into Tcl array

              Then you can use “array names x” to get the list of GVs

              Rob Abbott
              Cloverleaf Emeritus

          Viewing 2 reply threads
          • The forum ‘Cloverleaf’ is closed to new topics and replies.