4D v13.4Count parameters |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.4
Count parameters
Count parameters
The Count parameters command returns the number of parameters passed to a project method. WARNING: Count parameters is meaningful only in a project method that has been called by another method (project method or other). If the project method calling this command is associated with a menu, it returns 0. 4D project methods accept optional parameters, starting from the right. MyMethod(a;b;c;d) ` All parameters are passed Using Count parameters from within MyMethod, you can detect the actual number of parameters and perform different operations depending on what you have received. The following example displays a text message and can insert the text into a 4D Write area or send the text into a document on disk: ` APPEND TEXT Project Method After this project method has been added to your application, you can write: APPEND TEXT(vtSomeText) ` Will only display the text message 4D project methods accept a variable number of parameters of the same type, starting from the right. To declare these parameters, you use a compiler directive to which you pass ${N} as a variable, where N specifies the first parameter. Using Count parameters you can address those parameters with a For loop and the parameter indirection syntax. This example is a function that returns the greatest number received as parameter: ` Max of Project Method After this project method has been added to your application, you can write: vrResult:=Max of(Records in set("Operation A");Records in set("Operation B")) or: vrResult:=Max of(r1;r2;r3;r4;r5;r6) |
PROPERTIES
Product: 4D
INDEX HISTORY
Created: < 4D v6 SEE ALSO |
||||||||||||||||||||||||||||||||||||||||||||||||||||||