NEWS & TECH BLOG
Where are counters kept in GoldMine?
16/02/2015 – in GoldMine, SQL queries, StructureCounters can be very useful in GoldMine, and are often invoked from field lookups and from lookup.ini.
For instance if, in a field lookup, I put the following code:
~ltrim(str(counter("ABC",1)))
then, each time the entry is selected, the contents of a counter called ABC will placed into the field and the counter will increment by one. If the counter does not previously exist then it will be created.
(in this example the numeric counter is being converted to a string, as you’d need to do if you wanted to use it in any of the key fields, say).
So far so good, and possibly not exactly news to a lot of readers. However, where does this counter live?
Most of the time you can get by without knowing this, but it can sometimes be useful to be able to manipulate it from a SQL query, or even manually.
The answer is that it lives in the lookup table. An easy way of finding it would be to issue the following query:
select * from lookup where fieldname like 'ABC%'
You’d find that the fieldname field contains 'ABC C'
, where 10 characters sit before the ‘C’ (so, in our case, 3 letters and 7 spaces). The lookupsupp field contains the actual counter saved (perhaps perversely) as a string.