In order to bring you the best possible user experience, this site uses Javascript. If you are seeing this message, it is likely that the Javascript option in your browser is disabled. For optimal viewing of this site, please ensure that Javascript is enabled for your browser.
Login  |   On Demand  |   Home  |   qad.com




Calculated Fields Program Example
The following program used by QXO is an example of a calculated field program. The code converts the value stored in a database field into another format in the outgoing QDoc. The resulting format is suitable for use in an incoming QDoc through QXI.
 
$RCSfile: cp-pipartcode.p,v $
Copyright 1986-2004 QAD Inc., Carpinteria, CA, USA.
All rights reserved worldwide. This is an unpublished work.
Description: Checks the value of the pi_part_code field extracted from QAD Enterprise Applications. If it matches qadall variable we require to place blank for pi_part_code in the published business object
 
===============================================================
 
define input parameter dataset-handle phDataset.
define input parameter pcBuffer as character.
define input parameter pcQueryString as character.
define output parameter pcResult as character.
 
define variable hQuery as handle no-undo.
define variable hBuffer as handle no-undo.
define variable hField as handle no-undo.
 
define variable cQadAll as character initial "qadall--+--+--+--+--+" no-undo.
define variable cValue as character initial "" no-undo.
 
hBuffer = phDataset:get-buffer-handle(pcBuffer).
 
create query hQuery.
hQuery:add-buffer(hBuffer).
hQuery:query-prepare(pcQueryString).
hQuery:query-open().
hQuery:get-first().
 
if hBuffer:available then do:
hField = hBuffer:buffer-field("piPartCode") no-error.
if valid-handle(hField) then
cValue = hField:buffer-value.
if cValue = cQadAll then
cValue = "".
end.
 
hQuery:query-close().
 
pcResult = cValue.
delete object phDataset no-error.