tips:revmedia:subs4

CALCULATEX

Published ByDateVersionKnowledge LevelKeywords
Revelation Technologies14 NOV 19892.XEXPERTCALCULATEX

CALCULATEX is an external function that evaluates the specified field.

result = CALCULATEX(field, dict, id, record, mv)

CALCULATEX differs from R/BASIC CALCULATE only in relieving the user of the necessity to save and restore the values of @DICT, @RECORD, and @ID.

field

Field contains the name of the dictionary field to evaluate.

dict

Dict contains the source dictionary file.

id

Put the record key of the source record in id.

record

Place the source record in record.

mv

Mv contains the value number of the source value in a multivalued field. This value should be 0 (zero) if the field is single-valued.

CALCULATEX returns the result of evaluating field in the specified dictionary.

/* The following code opens a file and its associated 
dictionary, then uses CALCULATEX to evaluate one multivalue 
in a field from SAMPLE_CUSTOMERS. */

DECLARE SUBROUTINE FSMSG, MSG
DECLARE FUNCTION CALCULATEX

file  = "SAMPLE_CUSTOMERS"
field = "CONTACT_NAME"
dict  = "DICT SAMPLE_CUSTOMERS"
id    = 6
mv    = 2

OPEN file TO filevar ELSE FSMSG(); STOP
OPEN dict TO @DICT ELSE FSMSG(); STOP
READ @RECORD FROM filevar,id ELSE FSMSG(); STOP

result   = CALCULATEX(field, @DICT, id, @RECORD, mv)
text     = "Multivalue ":mv:" of the ":field:" field"
text<<-1>> = "for record ":id:" evaluates to |":result

MSG(text,"","","")
  • tips/revmedia/subs4.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1