Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 26 JUN 2003 05:56:21PM Jim Peters wrote:

Those of us working through the process of converting an AREV application have noticed that dictionary symbolics like this: {FIELDNAME_DEF} DO NOT work as defaults in OI forms. (You get a 'cannot read' error if you try it.)

Personnally I do not know why OI could not EASILY accommodate this, but it does not. If you are doing a conversion likely the AREV app has zillions of these, and dealing with them as individual functions or event code is very time (and PROFIT!) consuming.

I was not too thrilled with other solutions to this that I found here… all basically involving recreating what DEFAULT is supposed to do as a gotfocus event…. and reconstructing the original default logic within. Way too time consuming if you need to do it many times over.

Here is a little function I wrote that encapsulates a dictionary item into a function, so it can be called from the control's default.

Theoretically I should be able to retrieve the name of the table programmatically from the form (TABLE property of @WINDOW?)… but alas I could not… so it is specified as a parameter. Crude but it works.

If anyone has a *more elegant* solution please share, but here is what I came up with:

FUNCTION GET_DICT_DFLT(tablename,column)

/* this allows dict symbolics to be used for editline

defaults, by encapsulating the formula within a function.

This should also work with a literal field.

USE: Place this in the default line of a control with the

 table name and column name as parameters.

*/

* 06/26/03 Jim Peters Created

declare function unassigned, Get_Property

ans ="

if unassigned(tablename) then

tablename="

end

if unassigned(column) then

column="

end

if (tablename # "") AND (column # "") then

id     =Get_Property(@WINDOW,"ID")
rec    =Get_Property(@WINDOW,"RECORD")
@ID    =id
@RECORD=rec
Open "DICT", tablename to @DICT then
 ans=CALCULATE(column)
end else 
 call fsmsg(column)
end

end

return ans


At 26 JUN 2003 08:22PM Ray Chan wrote:

Jim,

Maybe this will help.

In the Default for the control, we call a program, e.g.,

GET_DEFAULT_VALUE('ZIP')

Notice I am passing one parameter "ZIP" or whatever. Maybe you can pass two separate parameters, but I haven't test that. This works for us however.

If you can't pass two parameters, but need to, then you might try something like this GET_MANAGER('ZIP*ZIP_FILE' and parse out the values you need.

HTH, and good luck on your journey. I think that you will really enjoy working with and using OI, especially OI32.

Ray Chan


At 27 JUN 2003 04:59AM Oystein Reigem wrote:

Jim,

Theoretically I should be able to retrieve the name of the table programmatically from the form (TABLE property of @WINDOW?)… but alas I could not… so it is specified as a parameter. Crude but it works.

See .

- Oystein -


At 27 JUN 2003 09:55AM Jim Peters wrote:

Ah, yes… that works!


WinID=@Window

$Insert OIWin_Comm_Init

TableName=JoinMap@


Thanks! to Oystein -] Carl Pates -] Andrew for the answer to that one.

The original version worked nicely, but it bugged me that I had to supply the table name when calling it.

Here is an updated version of the function that only requires the column name as a parameter:

=============================

FUNCTION GET_DICT_DFLT(Column)

/* this allows dict symbolics to be used for editline

defaults, by encapsulating the formula within a function.

This should also work with a literal field.

USEAGE: Place this in the default of a control with the

	column name supplied as a parameter.

06/26/03 Jim Peters Created

*/

declare subroutine fsmsg

declare function unassigned, Get_Property

TableName="

ans ="

WinID =@Window

$Insert OIWin_Comm_Init

TableName=JoinMap@

if unassigned(column) then

column="

end

if (TableName # "") AND (Column # "") then

@ID    =Get_Property(@WINDOW,"ID")
@RECORD=Get_Property(@WINDOW,"RECORD")
Open "DICT", TableName to @DICT then
 ans=CALCULATE(Column)
end else 
 call fsmsg()
end

end

return ans

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/6549656e97cd338985256d510078843b.txt
  • Last modified: 2023/12/28 07:40
  • by 127.0.0.1