/ Technical / Programming / Magik / UVAs

UVAs

A UVA (or Unique Value Allocator) is used to generate unique IDs, normally to be used in a key field in the database.

Extending an Exhausted UVA

The traceback should tell you which UVA has been exhausted, but it's most likely to be sw_gis!spatial_id

Get a handle on it to double check (the following code will cause a traceback when you try to get another value if that UVA has been exhausted)

t!v << gis_program_manager.cached_dataset(:gis)
$
t!v.goto_top_alternative()
$
u << t!v.uvas[:sw_gis!spatial_id]
$
u.get()
$

Now you've identified the exhausted UVA it's easy to extend. Double check the file it comes from and the current settings with

u.file
$
u.details
$

The values returned from the details represent High Water Mark (HWM), Maximum Value (MAX) and Number of Slots (NSLOTS) in that order. The following code uses those values so substitute them in where you see the abbreviations.

t!v.switch(:write)
$
t!v.remove_uva(:sw_gis!spatial_id)
$
t!v.create_uva(:sw_gis!spatial_id, "gdb.ds", MAX+1, MAX*2, NSLOTS)
$