I am trying to determine in a form if an entry is a new record or previously entered. I tried using the in the windows title bar but I've found that to be unreliable. Any suggestions would be greatly appreciated.
Richard Richter
Richard,
There are a couple of ways to do so.
1) If you programatically try to read the record using the 'READ' command, you can check the variable that is going to hold your data.
2) After the OI code is executed, the READ event is triggered, look at the @RECORD variable. If it's empty the record is new.
Good Luck…
Blaise
Blaise,
Could you please check if there is also some COMMON variable that gets set at READ time? I seem to remember something like that but I'm not sure …
Thanks
Dave
Richard,
When a key is entered and the record does not exist, the SYSMSG event is sent with the following message code (from PS_EQUATES):
EQU SYSMSG_NEWROWINFO$ TO 12 /* New row informational - null msg */
So your code in READ could look like:
declare subroutine Set_Property
$insert Logical
Set_Property(@window, "@NEW", FALSE$)
return 1
And your code in SYSMSG could look like:
declare subroutine Set_Property
$insert Logical
$insert PS_Equates
if MsgCode=SYSMSG_NEWROWINFO$ then
Set_Property(@window, "@NEW", TRUE$)end
return 1
From anywhere in your form, you can determine if the key is new by checking:
if Get_Property(@window, "@NEW") then …
Cameron Purdy
Revelation Software
Cameron just answered that. Thanks
Blaise,
Hate to be critical, but if the @RECORD is empty, it could be an empty record, not necessarily one that doesn't exist.
apk@sprezzatura.com