infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Cloverleaf
Can we get a list of Global Variable Keys in Tcl?
Jim Kosloskey
Cloverleaf 2209, Windows.
I am doing some work with Global Variables for the first time.
I am wondering if there is a way to get a list of all of the Global Variable Keys that exist in the table?
I don't see anything that pops out to me in the Documentation.
Find more posts tagged with
Clovertech
Comments
Jay
Does this get what you're looking for:
hcigvt
This command is used to access the global variables.
hcigvt {add|del|get|set|show} [varname] [varvalue] [isencrypted]
add - adds the global variable to the variable table.
del - deletes the global variable name from the variable table.
get - prints the global variable value of varname.
set - sets the global variable value of varname to a new value.
show - shows all the variable names and values in local site.
varname is the global variable name.
varvalue is the global variable value.
isencrypted determines if the global variable must be encrypted in the ini file.
1 indicates it is encrypted.
0 indicates it is not encrypted. This is the default.
For example:
C:\cloverleaf\cis6.3\integrator\bin>hcigvt show
Jim Kosloskey
That did it - thanks Jay.
Jeff Dinsmore
Interesting.
I've not seen this command before.
How does this differ from using Tcl's regular global variables?
Thanks,
Jeff.
Jim Kosloskey
I have noted this command dumps the Global Variables .ini file not the in-memory Table.
As well, it is not a list but a string with I think end of line or carriage control at the end of each line.
I will need to manipulate the dump some to convert it to a searchable list.
Perhaps this only works against the .ini file and not the in-memory Table, whereas the Tcl extensions address the in-memory table and not the .ini file.
I am finding that when I add an entry using the Tcl extensions in a UPoC, the in-memory Table is affected but the .ini is not. If I want my addition to be preserved then it appears I need to do a gvsave to save the in-memory table to the .ini file (then it is also visible in the GUI).
Charlie Bursell
Strange that hcigvt does not show ALL of the hci globals.
hcigvt show
HCIROOT = C:\cloverleaf\cis2022.09\integrator, encrypt = 0
HCISITE = charlieb, encrypt = 0
HCISITEDIR = C:\cloverleaf\cis2022.09\integrator\charlieb, encrypt = 0
tcl> info globals Hci*
HciSiteDir HciRoot HciSite HciProcessesDir HciMasterSiteDir HciMasterSite HciRootDir
Jim Kosloskey
Interesting, I get more when I do hcigvt:
C:\cloverleaf\cis2022.09\integrator\test_jim>hcitcl
hcitcl>hcigvt show
HCIROOT = C:\cloverleaf\cis2022.09\integrator, encrypt = 0
HCISITE = test_jim, encrypt = 0
HCISITEDIR = C:\cloverleaf\cis2022.09\integrator\test_jim, encrypt = 0
HCIMASTERSITE = master, encrypt = 0
HCIMASTERSITEDIR = C:\cloverleaf\cis2022.09\integrator\master, encrypt = 0
From master site:
HCIROOT = C:\cloverleaf\cis2022.09\integrator, encrypt = 0
HCISITE = master, encrypt = 0
HCISITEDIR = C:\cloverleaf\cis2022.09\integrator\master, encrypt = 0
hcitcl>
Jeff Dinsmore
And, interesting that I get less...
hcitcl>hcigvt show
Global variable is empty!
I must admit I've not used this command at all, but rather read from shell variables - mostly the global variable env for HCI-specific values like $env(HCIROOT)
Back to the original post... Jim - what is it that you're after here?
Jim Kosloskey
Jeff - I am in need of checking to see if a GV Key exists to know whether to change the value for the key (it can change with the integration I am building) or add the key and value.
I have found out I can do the gvgetvar Tcl command and if that returns a value the key exists. That is because one cannot have an empty (null) value for a key. That then tells me the key exists.
However, I can see a potential need to be able to search the GV table for a specific or range of keys.
Unfortunately, the hcigvt command only works on the .ini file. There is no such facility for the in-memory table. The two tables can be different. A modification to the in-memory table does not commit to the .ini file automatically.
I think there could be a use for something like a gvshowkeys Tcl command.
I have some other observations which I think could be enhancement requests. I will post those separately once I have all of them collected so I can add a poll as well.
Charlie Bursell
I guess my question would be: When are these variables added to the global namespace?
I added a global using hcigvt and ran Tcl from the command line and the global did not show up using the info globals command.
Other than possibly a need for an encrypted global like passwords, etc. What are the benefits of this command? It is so easy to set any global you want just by setting a variable in the global namespace, i.e., set ::myglobal foo, echo $::myglobal
Maybe I am missing something and there are other uses that I am not aware of. The documentation is not that enlightening
Jim Kosloskey
I am not sure they are added to the global namespace. I think that in what appears to be some instances (mine for example) they happen to match because they are placed in GV at perhaps engine startup.
What I am doing now for me is experimenting with this feature to see how it is used. Prospective use cases could grow out of this effort.
For this particular experiment I am using the GV as a repository for a value which needs to transcend engine shutdown and startup. I expecting to discover if that is true as part of this experiment.
In doing this I have discovered:
There are really 2 GV repositories: the .ini file and in-memory.
The Tcl command ONLY work on the in-memory table (with the exception of the save function).
The hcigvt command only works on the .ini file.
There does not appear to be a Tcl method to commit changes of the in-memory GV to the .ini.
There is a save Tcl function but that saves the in-memory to .ini in total. Not something I would do without a lot of planning.
One could use the hcigvt command along with the Tcl get command to save a particular in-memory entry to the .ini and this is what I am doing in this experiment. But I think it would be much better if there was a granular function in the Tcl set.
I suspect, but have not confirmed, that the in-memory GV gets set in total from the .ini at engine startup.
I have not investigated if there is any other way to get the in-memory reset to the .ini within the toolset other than perhaps using Tcl.
One can reset the .ini with the in-memory values as I indicated earlier by using the Tcl GV save function.
I will try to update this post with any other discoveries I make.
I really am looking forward to folks who have more experience than I do with GV to contribute their experiences and knowledge here. Including your use cases.
I am just trying to come to a better understanding of how GV works.
Jeff Dinsmore
I hate to spoil your fun, Jim, but this sounds more complex/uncertain than it needs to be.
Why not just use a regular file or SQLite (or other) DB?
Jim Kosloskey
Jeff,
This is a learning experiment to find out how this works. Once I am aware of the ins and outs, I can know how well it is likely to fit for various scenarios.
I do not have a project waiting to be finished or a strict time line. This is just me poking around.
I already know how to do the various other methods and their use cases. I am trying to build some additional knowledge.
I am also experimenting with other tools in Cloverleaf with which I am unfamiliar.
Feda Birani
Jim,
I've started to look at Global Variables and a bit stumped. From your investigation I now know there is 2 options, in-memory and .ini. I thought and now not sure, I was using .ini all along. I'm trying to store the newest token in the .ini. I do this by changing what is originally in the .ini (manually added) by doing the following
[gvdelvar token]
gvsave
[gvaddvar token $token] (notice not using $$prefix - still uncertain what $$prefix does. Is this used for in memory?)
gvsave
This works and I see the .ini get updated when i open the gui tool.
However, my issue is now trying to read what I've put in [hcigetvar token] on the reply tcl (diff tcl then where i added to .ini). Says variable not found. This makes me think it's something to do with memory because I'm able to do [hcigetvar token] successfully, if i put it in the same tcl I added it. I feel like I'm not understanding something.
How do you use the in memory, not ini and at what point do you loose what's in memory?
How do you add/update & get from the .ini. I'm using the site gv.ini not master site, so assuming no other site would be affected, only what sits in this one site. Also, did you find any slowness when GV was used?
Jim Kosloskey
Freda,
email me and we can discuss this off-line.
System
Originally posted by jianasingh
What is TCL?
Jim Kosloskey
Tcl Developer Site (tcl-lang.org)