Home page  
Help >
ddlCreateCalcObject() - create a calc object to be used by ddlGetCalc()
Version 7.11
ddlCreateCalcObject() - create a calc object to be used by ddlGetCalc()

ddlCreateCalcObject() is used to create a calc object to be used by ddlGetCalc().

Prototype:
   void ddlCreateCalcObject(
      CONTROL *ctl,
      char *OptnStr,
      char *ArgList,           /* command argument list */
      char *CalcSourceDef);
Permitted values in OptnStr:
/D - if a Calc Object with the same name exists, delete it automatically.
/O - if the source collection is empty, do not perform ATEND processing; that is, do not trigger the breakpoints [EVERY Sections], if any exist; and do not trigger the ATEND Section, if it exists.
This behavior is different than the default ATEND processing behavior. The default ATEND processing behavior is unconditionally to trigger all breakpoints [EVERY Sections] and the ATEND Section when the end of data condition occurs.
The /O option is meaningful for Calc Objects that are invoked thru ddlGetCalc(); as well as for Calc Objects that are invoked as POSTCALCOBJECT in ddlRelateEx().

Form of ArgList:
<Calc-Object-Name> [<cx>] { <Table-Name> | NULL }
Where:
<Calc-Object-Name> is the name to be assigned to this object; if an object with this name exists, it is unconditionally deleted;
<cx> is the name of the collection that is to be used with this Calc Object. This parameter is required if the target collection was created with the SORT-VALUE feature. However, it has been made optional to maintain compatibility with previous uses.
<Table-Name> is the name of the table if the target collection is table-specific; if the target collection is the global collection, this parameter is null;

In summary, there are two possible forms for this mode:
       Form 1: <calc-object-name> <cx> { <table-name> | NULL }
       Form 2: <calc-object-name> { <table-name> | NULL }     This form is obsolete, but is supported for compatibility

Form of CalcSourceDef:
CalcSourceDef is a memory block containing ascii Calc Object Definition statements. Each statement is terminated by ascii CR-LF [\r\n]. The block is terminated by the null character.
The permitted statements are:
Section Heads:
   RETURN Statement
   EVERY Statement
   ATEND Statement
   R_INITIAL Statement
Control:
   IF Statement
   ELSE Statement
   NELSE Statement
   ENDIF Statement
   WHILE Statement
   ENDWHILE Statement
   BREAK Statement
   END Statement
   EXIT Statement
Processing:
   PRINT Statement
   SELECT Statement
   WRITE Statement
   REWRITE Statement
   CALC Statement
   SET Statement
   INC Statement
   SUB [SUBSTITUTE] Statement
   NOTEMIT Statement
Debugging:
   DEBUG Statement
Special Functions:
   Search() Function
   Distinct() Function
   _ExtractIP() Function
   _pbcount() Function

Parameters may be fully qualified field names, local variable names and global variable names. Modifiers may be appended to field names and local variable names to create aggregates. The modifiers are:
[AVG] - average
[COUNT] - count
[DISCRETE] - discrete count
[SUM] - sum
[MAX] - max
[MIN] - min
[VAR] - varience
[STD] - standard deviation
[SSQ] - sum of squares

Description:

Alternate form:
There is an alternate form for this command which facilitates batch command format. In this form, the CalcSourceDef text is included in ArgList; and the *CalcSourceDef is NULL.

Form of ArgList:
<Calc-Object-Name> [<cx>] {<Table-Name> | NULL} <CalcSourceDef>
Where:
<Calc-Object-Name> is the name to be assigned to this object; if an object with this name exists, it is unconditionally deleted;
<cx> is the name of the collection that is to be used with this Calc Object. This parameter is required if the target collection was created with the SORT-VALUE feature. However, it has been made optional to maintain compatibility with previous uses.
<Table-Name> is the name of the table if the target collection is table-specific; if the target collection is the global collection, this parameter is the literal NULL;
<CalcSouceDef> is the symbolic Calc Object Definition. In this case, CalcSourceDef must be enclosed in "s; [this parameter is parsed in such a way that "s within the parameter do not cause a conflict.]

In summary, there are four possible forms for this mode:
       Form 3: <calc-object-name> <table-name> <calc-object-definition>
       Form 4: <calc-object-name> NULL <calc-object-definition>
       Form 5: <calc-object-name> <cx> <table-name> <calc-object-definition>
       Form 6: <calc-object-name> <cx> NULL <calc-object-definition>

Optionally, the CR-LFs within this form of CalcSourceDef may be replaced by double slashes ("//").

Form of CalcSourceDef:
In this case, this is the NULL pointer;

Copyright © 2019 , WhamTech, Inc.  All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. Names may be trademarks of their respective owners.