Key fields/descriptive symbolics (OpenInsight Specific)
At 18 NOV 1997 05:47:07PM Alex Cruise Eloquent wrote:
We've decided to implement relational fields and their descriptions as single fields/columns, rather than two dependant fields/columns.
The "easiest" way I can see to do this is to use an OConv to convert record keys ("internal" format) to descriptions.
The problem with this approach is that we want to actually call the _existing_ descriptive symbolics. Unfortunately, when OConvs are called during a form's read event, @@Window-]Record doesn't seem to contain the actual record yet. (of course neither does @Record.)
In AREV, this would be as simple as:
subroutine Desc( IO, Val, Conv, Res )
* DESC,fn
FieldName=Conv
if IO=OCONV" then
We're in a window, assume @ID, @DICT, @RECORD all have correct valuesRes=Calculate(FieldName)end
Any ideas on how to implement similar functionality without alot of code in my READ event?
TIA,
Alex
At 18 NOV 1997 10:32PM Dave Pociu wrote:
Alex,
Try this in your window's READ event:
call forward_event()
Your Code here
Both @record and @@window-]record should be initialized at this point
RETURN 0
Forward Event should take care of doing the actual read, fill in the @record and @@window-]record. Therefore at this point (after the Read but before the user gets access) you should be able to use the symbolics.
Let me know if that helps
Dave Pociu
At 19 NOV 1997 02:08PM Alex Cruise Eloquent wrote:
I'm already doing a Forward_Event(), Dave. My problem is that the OConvs happen *during* the system READ event handler, at a time when @@Window-]Record is not yet set.
At 19 NOV 1997 04:03PM Dave Pociu wrote:
I must have misunderstood what you want to do Alex. As a matter of fact I'm still not clear that I know exactly what you want (other than the ability to use Calculate on a symbolic).
Sorry for waisting your time. I don't have any ideas other than the obvious : programatically initializing @record, @dict and @id before the forward_event() so that something is in there already.
At 19 NOV 1997 05:59PM Cameron Revelation wrote:
Alex,
In AREV, this would be as simple as:
<code> if IO=OCONV" then * We're in a window, assume @ID, @DICT, @RECORD all have correct values</code>
I believe I understand what you are trying to do. Your assumption is incorrect though: In Arev you cannot assume that OCONV is called in a window and you cannot assume that @dict, @id, and @record mean anything. The OCONV code is passed to the custom conversion any time that the BASIC+ operations fmt() or oconv() (which are the same thing BTW) are used with that custom conversion.
The developer of the custom conversion can assume:
1) The information supplied in the parameters to the custom conversion
2) The database is available if necessary to verify, look up, or help in converting the data
The developer of the custom conversion cannot assume:
1) Event context
2) @record/@dict/@id/@mv
3) Cursor 0 is available
The first item above means that you should not use get_property and set_property (and other PS-related functions).
The second item means that, if you require any of the dictionary-related globals to be set, you must:
1) Use Push.Session to store them
2) Set them up (open dictionary, set id, read record, …)
3) Use them as necessary
4) Use Pop.Session to re-store them before you return
The last item means that, if you require the use of cursor 0, you must use Push.Select before using it and Pop.Select after.
Hope this helps,
Cameron Purdy
—————————–14692093719953–