This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v19
VP ADD FORMULA NAME

VP ADD FORMULA NAME 


 

VP ADD FORMULA NAME ( vpAreaName ; vpFormula ; name {; options} )  
Parameter Type   Description
vpAreaName  Text in 4D View Pro area form object name
vpFormula  Text in 4D View Pro formula
name  Text in Name for the fomula
options  Object in 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:

 

PropertyTypeDescription
scopeNumberScope for the formula. You can pass the sheet index (counting begins at 0) or use the following constants:

Constant Value Comment
vk current sheet -1 Designates current sheet of the 4D View Pro area (default)
vk workbook -2 Designates the entire workbook of the 4D View Pro area.

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).

baseRowNumber(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.
baseColumnNumber(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.
commentTextComment 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

 



See also 

Cell references
VP Get formula by name
VP Get names

 
PROPERTIES 

Product: 4D
Theme: 4D View Pro Language
Number: 9556

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v17 R4

 
ARTICLE USAGE

4D View Pro Reference ( 4D v19)