Basic Database Data Techniques

Comparing Enumerator Values

This is something that may be documented somewhere, but I just never found it. If you get the value of a field of a record that is an enumerated value, the value is typically a string (more correctly, a ds_char16_vec [or some other stored character string]). If you need to test against that value you need to do an '=' test. And if you have translation functionality, you would need to do multiple tests or use a message handler. However there is another field that actually returns the integer value of the enumerator. It is named 'dsint!field_name'

In-memory Enumerators

Temporary Database Storage

A little known feature with the versioned database is the ability to create a temporary alternative to store data. This very useful if you are doing a large amount of analysis that may cause your memory to exceed operating restrictions. Another option would be to cache things so you do not not need to recalculate the data many times (especially for drawing).

To create this temporary alternative, you use ds_version_view.create_scratchpad(). See the method comments for details, but one great thing about this functionality is that if you cleanly leave the alternative, all of the UVAs associated with this temporary alternative are returned to the system!

Quinn Hiebert at Fasterre has played with this and could provide more information on how he used it.

Scrapbook (Clipboard)

The Scrapbook from the Smallworld Explorer allows you to easily park record sets for future uses. Typically you will see utilities give you the option of using selected records or 'Scrapbook.' If there are processes that run on dataless RWOs (non geometry records) the only way of getting a handle on a select few is throught the Scrapbook.

To set the Scrapbook use set_clipboard() on the scrapbook object like the following.


To get data from the Scrapbook get the elements of each clipboard like the following. Note the data may be detached records….

_local recs <<
_for aCB _over gis_program_manager.scrapbook().clipboard.fast_elements()

Saving Current Scrapbook

You can save the current Scrapbook for future use even after session restart.


Coordinate System Look Ups

Spatial Reference Coding

Below is some code that will look up coordinate systems based on code and optionally unit. Spatial Reference Website contains many ESRI & ESPG codes that are commonly used.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License