This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20.6
Copy parameters
|
Copy parameters {( startFrom )} -> Function result | ||||||||
Parameter | Type | Description | ||||||
startFrom | Longint |
![]() |
Starting index (included) | |||||
Function result | Collection |
![]() |
New collection containing parameters actually passed | |||||
The Copy parameters command returns a new collection containing all parameters actually passed to a method or a function. This command is useful when you need to forward a various number of parameters from a method or function to another method or function.
In the startFrom optional parameter, you can pass the index of the parameter from which to start collecting parameters to forward. The startFrom parameter itself is included.
When called inside a formula, Copy parameters returns the parameters passed explicitely using apply() or call() (and not those passed to the parent method or function).
Copy parameters returns an empty collection if:
Calling a different function depending on the first parameter and passing other parameters to this function:
Function selectTask($task Text)
Case of
:($task="Task1")
This.task1(Copy parameters(2))
:($task="Task2")
This.task2(Copy parameters(2))
End case
Or, calling another function on another object with apply() and pass the parameters:
Function doSomething($param Text;$extraParameters Variant)
This.delegate.doSomething.apply(This.delegate;Copy parameters)
Since the command returns a collection, it can be used with .join() to build for example a html list:
// Class
Function list($typeText)->Text
//type of list is "u" or "o"
var $value : Collection
$value:=Copy parameters(2)
$html:="<"+$type+"l><li>"
$html+=$value.join("</li><li>")
$html+="</li></"+$type+"l>"
return$html
// Method
$htmlList:=$c.list("u";"Alpha";"Bravo";"Charlie")
// $htmlList = <ul><li>Alpha</li><li>Bravo</li><li>Charlie</li></ul>
Product: 4D
Theme: Language
Number:
1790
Created: 4D v19 R5
4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)