Description
Get the value of primary key fields of current record in a class temp-table.
PreCondition
This method does not do any read operations. A record must be available in the default buffer of the class temp-table.
Parameters
ihBuffer | input | handle | handle to class temp-table buffer |
ocPKValue | output | character | chr(2) seperated list of field values |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program1/database.p)
if oiReturnStatus = 0
then oiReturnStatus = -98.
if ihBuffer:type = "TEMP-TABLE":U
then assign ihBuffer = ihBuffer:default-buffer-handle.
if ihBuffer:type <> "BUFFER":U
then return.
if ihBuffer:available
then do:
vcTableName = substring(ihBuffer:table,4,-1,"CHARACTER":U).
<M-1 run GetKeyFields (input-output vcTableName (bcTableName),
output vcPK (ocPrimaryKey),
output vcAK (ocAlternateKey),
output vcID (ocObjectID),
output vcStatus (ocObjectStatus),
output viFcReturnSuper (oiReturnStatus)) in database>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
do viFcCount1 = 1 to num-entries(vcPK):
if viFcCount1 > 1
then ocPKValue = ocPKValue + chr(2).
vhField = ihBuffer:buffer-field(entry(viFcCount1,vcPK)).
if vhField:buffer-value = ?
then ocPKValue = ocPKValue + "?":U.
else case vhField:data-type:
when "logical":U
then if vhField:buffer-value = true
then ocPKValue = ocPKValue + "true":U.
else ocPKValue = ocPKValue + "false":U.
when "date":U
then assign vtemp = vhField:buffer-value
ocPKValue = ocPKValue + string(year(vtemp),"9999":U)
+ string(month(vtemp),"99":U)
+ string(day(vtemp),"99":U).
otherwise ocPKValue = ocPKValue + string(vhField:buffer-value).
end case.
end.
end.
if oiReturnStatus = -98
then oiReturnStatus = 0.