This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19
VP ADD FORMULA NAME
|
VP ADD FORMULA NAME ( vpAreaName ; vpFormula ; name {; options} ) | ||||||||
Parameter | Type | Description | ||||||
vpAreaName | Text |
![]() |
4D View Pro area form object name | |||||
vpFormula | Text |
![]() |
4D View Pro formula | |||||
name | Text |
![]() |
Name for the fomula | |||||
options | Object |
![]() |
Options for the named formula | |||||
The VP ADD FORMULA NAME command creates or modifies a named formula in the open document.
Note: Named formulas created by this command are saved with the document.
In vpAreaName, pass the name of the 4D View Pro area. If you pass a name that does not exist, an error is returned.
Pass the 4D View Pro formula that you want to name in vpFormula. For detailed information about formula syntax, please refer to the 4D View Pro Formulas section.
Pass the new name for the formula in name. If the name is already used within the same scope, the new named formula replaces the existing one. Note that you can use the same name for different scopes (see below).
You can pass an object with additional properties for the named formula in options. The following properties are supported:
Property | Type | Description | |||||||||
scope | Number | Scope for the formula. You can pass the sheet index (counting begins at 0) or use the following constants:
Note: The scope determines whether a formula name is local to a given worksheet (scope=sheet index or vk current sheet), or global across the entire workbook (scope=vk workbook). | |||||||||
baseRow | Number | (optional) Custom starting point (cell row) for relative references in the formula. If omitted, relative references will use (0;0) as a starting point. When used, baseColumn is mandatory. | |||||||||
baseColumn | Number | (optional) Custom starting point (cell column) for relative references in the formula. If omitted, relative references will use (0;0) as a starting point. When used, baseRow is mandatory. | |||||||||
comment | Text | Comment associated to named formula |
VP ADD FORMULA NAME("ViewProArea";"SUM($A$1:$A$10)";"Total2")
You want to create a named formula that references the two cells immediately above it.
//calculate the sum relatively from A1 to A2
//and base the formula in baseRow=2 and baseColumn=0 (A3)
VP ADD FORMULA NAME("vpArea";"SUM(A1:A2)";"sum2Above";New object("baseRow";2;"baseColumn";0))
//then it can be applied anywhere, here in D5
Product: 4D
Theme: 4D View Pro Language
Number:
9556
Created: 4D v17 R4
4D View Pro Reference ( 4D v19)