@univerjs/engine-formula v0.5.4


Class: CustomFunction

Defined in: submodules/univer/packages/engine-formula/src/functions/custom-function.ts:19

Extends

Extended by

Constructors

new CustomFunction()

new CustomFunction(_name): CustomFunction

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:92

Parameters

ParameterType
_nameIFunctionNames

Returns

CustomFunction

Inherited from

BaseFunction.constructor

Properties

PropertyModifierTypeDefault valueDescriptionInherited fromDefined in
_columnCountprotectednumber-1-BaseFunction._columnCountsubmodules/univer/packages/engine-formula/src/functions/base-function.ts:50
_formulaDataModelprotectedNullable<FormulaDataModel>undefined-BaseFunction._formulaDataModelsubmodules/univer/packages/engine-formula/src/functions/base-function.ts:48
_rowCountprotectednumber-1-BaseFunction._rowCountsubmodules/univer/packages/engine-formula/src/functions/base-function.ts:49
maxParamspublicnumber-1Maximum number of parametersBaseFunction.maxParamssubmodules/univer/packages/engine-formula/src/functions/base-function.ts:90
minParamspublicnumber-1Minimum number of parametersBaseFunction.minParamssubmodules/univer/packages/engine-formula/src/functions/base-function.ts:85
needsExpandParamspublicbooleanfalseWhether the function needs to expand the parametersBaseFunction.needsExpandParamssubmodules/univer/packages/engine-formula/src/functions/base-function.ts:55
needsFormulaDataModelpublicbooleanfalseWhether the function needs function methods in FormulaDataModelBaseFunction.needsFormulaDataModelsubmodules/univer/packages/engine-formula/src/functions/base-function.ts:75
needsLocalepublicbooleanfalseWhether the function needs handle localeBaseFunction.needsLocalesubmodules/univer/packages/engine-formula/src/functions/base-function.ts:65
needsReferenceObjectpublicbooleanfalseWhether the function needs to pass in reference objectBaseFunction.needsReferenceObjectsubmodules/univer/packages/engine-formula/src/functions/base-function.ts:60
needsSheetRowColumnCountpublicbooleanfalseWhether the function needs the number of rows and columns in the sheetBaseFunction.needsSheetRowColumnCountsubmodules/univer/packages/engine-formula/src/functions/base-function.ts:80
needsSheetsInfopublicbooleanfalseWhether the function needs sheets infoBaseFunction.needsSheetsInfosubmodules/univer/packages/engine-formula/src/functions/base-function.ts:70

Accessors

column

Get Signature

get column(): number

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:112

Returns

number

Inherited from

BaseFunction.column


name

Get Signature

get name(): IFunctionNames

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:96

Returns

IFunctionNames

Inherited from

BaseFunction.name


row

Get Signature

get row(): number

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:108

Returns

number

Inherited from

BaseFunction.row


subUnitId

Get Signature

get subUnitId(): Nullable<string>

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:104

Returns

Nullable<string>

Inherited from

BaseFunction.subUnitId


unitId

Get Signature

get unitId(): Nullable<string>

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:100

Returns

Nullable<string>

Inherited from

BaseFunction.unitId

Methods

binarySearch()

binarySearch(
   value, 
   searchArray, 
   resultArray, 
   searchType?, 
   matchType?): BaseValueObject

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:316

Parameters

ParameterType
valueBaseValueObject
searchArrayArrayValueObject
resultArrayArrayValueObject
searchType?ArrayBinarySearchType
matchType?ArrayOrderSearchType

Returns

BaseValueObject

Inherited from

BaseFunction.binarySearch


binarySearchExpand()

binarySearchExpand(
   value, 
   searchArray, 
   resultArray, 
   axis, 
   searchType?, 
   matchType?): 
  | undefined
  | ErrorValueObject
  | ArrayValueObject

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:403

Parameters

ParameterTypeDefault value
valueBaseValueObjectundefined
searchArrayArrayValueObjectundefined
resultArrayArrayValueObjectundefined
axisnumber0
searchType?ArrayBinarySearchTypeundefined
matchType?ArrayOrderSearchTypeundefined

Returns

| undefined | ErrorValueObject | ArrayValueObject

Inherited from

BaseFunction.binarySearchExpand


calculate()

calculate(...arg): NodeValueType

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:200

Parameters

ParameterType
argBaseValueObject[]

Returns

NodeValueType

Inherited from

BaseFunction.calculate


calculateCustom()

calculateCustom(...arg): 
  | FormulaFunctionResultValueType
| Promise<FormulaFunctionResultValueType>

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:194

Parameters

ParameterType
argFormulaFunctionValueType[]

Returns

| FormulaFunctionResultValueType | Promise<FormulaFunctionResultValueType>

Inherited from

BaseFunction.calculateCustom


checkArrayType()

checkArrayType(variant): boolean

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:204

Parameters

ParameterType
variantFunctionVariantType

Returns

boolean

Inherited from

BaseFunction.checkArrayType


createReferenceObject()

createReferenceObject(reference, range): 
  | ErrorValueObject
  | BaseReferenceObject

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:562

Parameters

ParameterType
referenceBaseReferenceObject
rangeIRange

Returns

| ErrorValueObject | BaseReferenceObject

Inherited from

BaseFunction.createReferenceObject


dispose()

dispose(): void

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:116

Returns

void

Inherited from

BaseFunction.dispose


equalSearch()

equalSearch(
   value, 
   searchArray, 
   resultArray, 
   isFirst): BaseValueObject

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:361

Parameters

ParameterTypeDefault value
valueBaseValueObjectundefined
searchArrayArrayValueObjectundefined
resultArrayArrayValueObjectundefined
isFirstbooleantrue

Returns

BaseValueObject

Inherited from

BaseFunction.equalSearch


equalSearchExpand()

equalSearchExpand(
   value, 
   searchArray, 
   resultArray, 
   isFirst, 
   axis): 
  | undefined
  | ErrorValueObject
  | ArrayValueObject

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:423

Parameters

ParameterTypeDefault value
valueBaseValueObjectundefined
searchArrayArrayValueObjectundefined
resultArrayArrayValueObjectundefined
isFirstbooleantrue
axisnumber0

Returns

| undefined | ErrorValueObject | ArrayValueObject

Inherited from

BaseFunction.equalSearchExpand


flattenArray()

flattenArray(variants, ignoreLogicalValuesAndText): 
  | BaseValueObject
  | ArrayValueObject

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:497

Parameters

ParameterTypeDefault value
variantsBaseValueObject[]undefined
ignoreLogicalValuesAndTextbooleantrue

Returns

| BaseValueObject | ArrayValueObject

Inherited from

BaseFunction.flattenArray


fuzzySearch()

fuzzySearch(
   value, 
   searchArray, 
   resultArray, 
   isFirst): BaseValueObject

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:371

Parameters

ParameterTypeDefault value
valueBaseValueObjectundefined
searchArrayArrayValueObjectundefined
resultArrayArrayValueObjectundefined
isFirstbooleantrue

Returns

BaseValueObject

Inherited from

BaseFunction.fuzzySearch


fuzzySearchExpand()

fuzzySearchExpand(
   value, 
   searchArray, 
   resultArray, 
   isFirst, 
   axis): 
  | undefined
  | ErrorValueObject
  | ArrayValueObject

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:450

Parameters

ParameterTypeDefault value
valueBaseValueObjectundefined
searchArrayArrayValueObjectundefined
resultArrayArrayValueObjectundefined
isFirstbooleantrue
axisnumber0

Returns

| undefined | ErrorValueObject | ArrayValueObject

Inherited from

BaseFunction.fuzzySearchExpand


getDefinedName()

getDefinedName(name): 
  | null
  | IDefinedNamesServiceParam

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:126

In Excel, to inject a defined name into a function that has positioning capabilities, such as using the INDIRECT function to reference a named range, you can write it as follows: =INDIRECT(“DefinedName1”)

Parameters

ParameterType
namestring

Returns

| null | IDefinedNamesServiceParam

Inherited from

BaseFunction.getDefinedName


getIndexNumValue()

getIndexNumValue(indexNum, defaultValue): number | ErrorValueObject

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:214

Starting with 1 For instance, The column number (starting with 1 for the left-most column of table_array) that contains the return value. https://support.microsoft.com/en-us/office/vlookup-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1

Parameters

ParameterTypeDefault value
indexNumBaseValueObjectundefined
defaultValuenumber1

Returns

number | ErrorValueObject

Inherited from

BaseFunction.getIndexNumValue


getLocale()

getLocale(): LocaleType

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:140

Returns

LocaleType

Inherited from

BaseFunction.getLocale


getMatchTypeValue()

getMatchTypeValue(logicValueObject?): undefined | number

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:288

A logical value that specifies 1/TRUE , 0/FALSE, -1, default 1. The difference from getZeroOrOneByOneDefault is that we need to get -1

Parameters

ParameterType
logicValueObject?BaseValueObject

Returns

undefined | number

Inherited from

BaseFunction.getMatchTypeValue


getSheetsInfo()

getSheetsInfo(): {
  sheetNameMap: {};
  sheetOrder: string[];
}

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:148

Returns

{
  sheetNameMap: {};
  sheetOrder: string[];
}
NameTypeDefined in
sheetNameMap{}submodules/univer/packages/engine-formula/src/functions/base-function.ts:151
sheetOrderstring[]submodules/univer/packages/engine-formula/src/functions/base-function.ts:150

Inherited from

BaseFunction.getSheetsInfo


getZeroOrOneByOneDefault()

getZeroOrOneByOneDefault(logicValueObject?): undefined | number

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:255

A logical value that specifies 1/TRUE , 0/FALSE, default 1 For instance range_lookup, A logical value that specifies whether you want VLOOKUP to find an approximate or an exact match Approximate match - 1/TRUE Exact match - 0/FALSE https://support.microsoft.com/en-us/office/vlookup-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1 For instance A1, A logical value that specifies what type of reference is contained in the cell ref_text. If a1 is TRUE or omitted, ref_text is interpreted as an A1-style reference. If a1 is FALSE, ref_text is interpreted as an R1C1-style reference. https://support.microsoft.com/zh-cn/office/indirect-%E5%87%BD%E6%95%B0-474b3a3a-8a26-4f44-b491-92b6306fa261

Parameters

ParameterType
logicValueObject?BaseValueObject

Returns

undefined | number

Inherited from

BaseFunction.getZeroOrOneByOneDefault


isAddress()

isAddress(): boolean

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:179

Returns

boolean

Inherited from

BaseFunction.isAddress


isAsync()

isAsync(): boolean

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:175

Returns

boolean

Inherited from

BaseFunction.isAsync


isCustom()

isCustom(): boolean

Defined in: submodules/univer/packages/engine-formula/src/functions/custom-function.ts:20

Returns

boolean

Overrides

BaseFunction.isCustom


orderSearch()

orderSearch(
   value, 
   searchArray, 
   resultArray, 
   searchType, 
   isDesc): BaseValueObject

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:381

Parameters

ParameterTypeDefault value
valueBaseValueObjectundefined
searchArrayArrayValueObjectundefined
resultArrayArrayValueObjectundefined
searchTypeArrayOrderSearchTypeArrayOrderSearchType.MIN
isDescbooleanfalse

Returns

BaseValueObject

Inherited from

BaseFunction.orderSearch


orderSearchExpand()

orderSearchExpand(
   value, 
   searchArray, 
   resultArray, 
   searchType, 
   isDesc, 
   axis): 
  | undefined
  | ErrorValueObject
  | ArrayValueObject

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:477

Parameters

ParameterTypeDefault value
valueBaseValueObjectundefined
searchArrayArrayValueObjectundefined
resultArrayArrayValueObjectundefined
searchTypeArrayOrderSearchTypeArrayOrderSearchType.MIN
isDescbooleanfalse
axisnumber0

Returns

| undefined | ErrorValueObject | ArrayValueObject

Inherited from

BaseFunction.orderSearchExpand


setDefinedNames()

setDefinedNames(definedNames): void

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:136

Parameters

ParameterType
definedNamesIDefinedNameMapItem

Returns

void

Inherited from

BaseFunction.setDefinedNames


setFormulaDataModel()

setFormulaDataModel(_formulaDataModel): void

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:166

Parameters

ParameterType
_formulaDataModelFormulaDataModel

Returns

void

Inherited from

BaseFunction.setFormulaDataModel


setLocale()

setLocale(locale): void

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:144

Parameters

ParameterType
localeLocaleType

Returns

void

Inherited from

BaseFunction.setLocale


setRefInfo()

setRefInfo(
   unitId, 
   subUnitId, 
   row, 
   column): void

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:187

Parameters

ParameterType
unitIdstring
subUnitIdstring
rownumber
columnnumber

Returns

void

Inherited from

BaseFunction.setRefInfo


setSheetRowColumnCount()

setSheetRowColumnCount(rowCount, columnCount): void

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:170

Parameters

ParameterType
rowCountnumber
columnCountnumber

Returns

void

Inherited from

BaseFunction.setSheetRowColumnCount


setSheetsInfo()

setSheetsInfo(__namedParameters): void

Defined in: submodules/univer/packages/engine-formula/src/functions/base-function.ts:155

Parameters

ParameterType
__namedParameters{ sheetNameMap: {}; sheetOrder: string[]; }
__namedParameters.sheetNameMap{}
__namedParameters.sheetOrderstring[]

Returns

void

Inherited from

BaseFunction.setSheetsInfo