Data type conversion: handle - inte - handle

gander

New Member
It may seem strange, but I have a good reason for doing it. I want to save a handle to a field in a database table. There is no data-type handle in field definitions, but I can save the handle as table.fieldname = INTE(handle). However, when I read the record back I cannot reconvert by using variablename = HANDLE(table.fieldname). I've tried using WIDGET-HANDLE as well, as they're interchangeable, but met with no success.

I know it can be done with temp-tables, but this will not solve my somewhat esoteric problem.

Any ideas would be appreciated - thanks
 

joey.jeremiah

ProgressTalk Moderator
Staff member
a widget-handle is an object handle, the reason for all that is because
widgets came before other dynamic object.

just a few examples are widget-handle( ), create widget-pool etc. that
apply to non-widget dynamic objects.

a handle is a reference to an object, not it's content or "value", and as
you already know it can be represented as an integer.


i can think of possible scenarios, for example, a context database that
also holds persistent proc handles running on an appserver.

but as you can tell from the example, if the object has been deleted
the handle points to an object that doesn't exist, and is invalid.


you can save the widget's "value" i.e. attributes etc. in a database
and later on recreate it dynamically.

keep in mind that, in general, you pay a price for using dynamic over
static objects ( in terms of complexity, performance etc. ).
 

Shawn

New Member
Do like Progress

Instead of an Integer try a character field.
The try
if valid-handle(widget-handle(db.charHandle)).
 

M-HT

Member
Or convert it to STRING then to WIDGET-HANDLE.
Like this:
variablename = WIDGET-HANDLE(STRING(table.fieldname))
 
Top