API Reference
@univerjs
@univerjs/engine-formula
classes
Customfunction

@univerjs/engine-formula v0.4.2Docs


Class: CustomFunction

Extends

Constructors

new CustomFunction()

new CustomFunction(_name): CustomFunction

Parameters

ParameterType
_nameIFunctionNames

Returns

CustomFunction

Inherited from

BaseFunction.constructor

Defined in

packages/engine-formula/src/functions/base-function.ts:79 (opens in a new tab)

Properties

PropertyTypeDefault valueDescriptionInherited fromDefined in
maxParamsnumber-1Maximum number of parametersBaseFunction.maxParamspackages/engine-formula/src/functions/base-function.ts:77 (opens in a new tab)
minParamsnumber-1Minimum number of parametersBaseFunction.minParamspackages/engine-formula/src/functions/base-function.ts:72 (opens in a new tab)
needsExpandParamsbooleanfalseWhether the function needs to expand the parametersBaseFunction.needsExpandParamspackages/engine-formula/src/functions/base-function.ts:52 (opens in a new tab)
needsLocalebooleanfalseWhether the function needs handle localeBaseFunction.needsLocalepackages/engine-formula/src/functions/base-function.ts:62 (opens in a new tab)
needsReferenceObjectbooleanfalseWhether the function needs to pass in reference objectBaseFunction.needsReferenceObjectpackages/engine-formula/src/functions/base-function.ts:57 (opens in a new tab)
needsSheetsInfobooleanfalseWhether the function needs sheets infoBaseFunction.needsSheetsInfopackages/engine-formula/src/functions/base-function.ts:67 (opens in a new tab)

Accessors

column

get column(): number

Returns

number

Inherited from

BaseFunction.column

Defined in

packages/engine-formula/src/functions/base-function.ts:99 (opens in a new tab)


name

get name(): IFunctionNames

Returns

IFunctionNames

Inherited from

BaseFunction.name

Defined in

packages/engine-formula/src/functions/base-function.ts:83 (opens in a new tab)


row

get row(): number

Returns

number

Inherited from

BaseFunction.row

Defined in

packages/engine-formula/src/functions/base-function.ts:95 (opens in a new tab)


subUnitId

get subUnitId(): Nullable<string>

Returns

Nullable<string>

Inherited from

BaseFunction.subUnitId

Defined in

packages/engine-formula/src/functions/base-function.ts:91 (opens in a new tab)


unitId

get unitId(): Nullable<string>

Returns

Nullable<string>

Inherited from

BaseFunction.unitId

Defined in

packages/engine-formula/src/functions/base-function.ts:87 (opens in a new tab)

Methods

binarySearch()

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

Parameters

ParameterType
valueBaseValueObject
searchArrayArrayValueObject
resultArrayArrayValueObject
searchType?ArrayBinarySearchType
matchType?ArrayOrderSearchType

Returns

BaseValueObject

Inherited from

BaseFunction.binarySearch

Defined in

packages/engine-formula/src/functions/base-function.ts:294 (opens in a new tab)


binarySearchExpand()

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

Parameters

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

Returns

undefined | ErrorValueObject | ArrayValueObject

Inherited from

BaseFunction.binarySearchExpand

Defined in

packages/engine-formula/src/functions/base-function.ts:380 (opens in a new tab)


calculate()

calculate(...arg): NodeValueType

Parameters

ParameterType
...argBaseValueObject[]

Returns

NodeValueType

Inherited from

BaseFunction.calculate

Defined in

packages/engine-formula/src/functions/base-function.ts:178 (opens in a new tab)


calculateCustom()

calculateCustom(...arg): PrimitiveValueType | PrimitiveValueType[][]

Parameters

ParameterType
...arg(PrimitiveValueType | PrimitiveValueType[][])[]

Returns

PrimitiveValueType | PrimitiveValueType[][]

Inherited from

BaseFunction.calculateCustom

Defined in

packages/engine-formula/src/functions/base-function.ts:172 (opens in a new tab)


checkArrayType()

checkArrayType(variant): boolean

Parameters

ParameterType
variantFunctionVariantType

Returns

boolean

Inherited from

BaseFunction.checkArrayType

Defined in

packages/engine-formula/src/functions/base-function.ts:182 (opens in a new tab)


createReferenceObject()

createReferenceObject(reference, range): ErrorValueObject | BaseReferenceObject

Parameters

ParameterType
referenceBaseReferenceObject
rangeIRange

Returns

ErrorValueObject | BaseReferenceObject

Inherited from

BaseFunction.createReferenceObject

Defined in

packages/engine-formula/src/functions/base-function.ts:539 (opens in a new tab)


dispose()

dispose(): void

Returns

void

Inherited from

BaseFunction.dispose

Defined in

packages/engine-formula/src/functions/base-function.ts:103 (opens in a new tab)


equalSearch()

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

Parameters

ParameterTypeDefault value
valueBaseValueObjectundefined
searchArrayArrayValueObjectundefined
resultArrayArrayValueObjectundefined
isFirstbooleantrue

Returns

BaseValueObject

Inherited from

BaseFunction.equalSearch

Defined in

packages/engine-formula/src/functions/base-function.ts:338 (opens in a new tab)


equalSearchExpand()

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

Parameters

ParameterTypeDefault value
valueBaseValueObjectundefined
searchArrayArrayValueObjectundefined
resultArrayArrayValueObjectundefined
isFirstbooleantrue
axisnumber0

Returns

undefined | ErrorValueObject | ArrayValueObject

Inherited from

BaseFunction.equalSearchExpand

Defined in

packages/engine-formula/src/functions/base-function.ts:400 (opens in a new tab)


flattenArray()

flattenArray(variants, ignoreLogicalValuesAndText): BaseValueObject | ArrayValueObject

Parameters

ParameterTypeDefault value
variantsBaseValueObject[]undefined
ignoreLogicalValuesAndTextbooleantrue

Returns

BaseValueObject | ArrayValueObject

Inherited from

BaseFunction.flattenArray

Defined in

packages/engine-formula/src/functions/base-function.ts:474 (opens in a new tab)


fuzzySearch()

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

Parameters

ParameterTypeDefault value
valueBaseValueObjectundefined
searchArrayArrayValueObjectundefined
resultArrayArrayValueObjectundefined
isFirstbooleantrue

Returns

BaseValueObject

Inherited from

BaseFunction.fuzzySearch

Defined in

packages/engine-formula/src/functions/base-function.ts:348 (opens in a new tab)


fuzzySearchExpand()

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

Parameters

ParameterTypeDefault value
valueBaseValueObjectundefined
searchArrayArrayValueObjectundefined
resultArrayArrayValueObjectundefined
isFirstbooleantrue
axisnumber0

Returns

undefined | ErrorValueObject | ArrayValueObject

Inherited from

BaseFunction.fuzzySearchExpand

Defined in

packages/engine-formula/src/functions/base-function.ts:427 (opens in a new tab)


getDefinedName()

getDefinedName(name): null | IDefinedNamesServiceParam

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

Defined in

packages/engine-formula/src/functions/base-function.ts:113 (opens in a new tab)


getIndexNumValue()

getIndexNumValue(indexNum, defaultValue): number | ErrorValueObject

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 (opens in a new tab)

Parameters

ParameterTypeDefault value
indexNumBaseValueObjectundefined
defaultValuenumber1

Returns

number | ErrorValueObject

Inherited from

BaseFunction.getIndexNumValue

Defined in

packages/engine-formula/src/functions/base-function.ts:192 (opens in a new tab)


getLocale()

getLocale(): LocaleType

Returns

LocaleType

Inherited from

BaseFunction.getLocale

Defined in

packages/engine-formula/src/functions/base-function.ts:127 (opens in a new tab)


getMatchTypeValue()

getMatchTypeValue(logicValueObject?): undefined | number

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

Defined in

packages/engine-formula/src/functions/base-function.ts:266 (opens in a new tab)


getSheetsInfo()

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

Returns

{
  sheetNameMap: {};
  sheetOrder: string[];
}
NameTypeDefined in
sheetNameMap{}packages/engine-formula/src/functions/base-function.ts:138 (opens in a new tab)
sheetOrderstring[]packages/engine-formula/src/functions/base-function.ts:137 (opens in a new tab)

Inherited from

BaseFunction.getSheetsInfo

Defined in

packages/engine-formula/src/functions/base-function.ts:135 (opens in a new tab)


getZeroOrOneByOneDefault()

getZeroOrOneByOneDefault(logicValueObject?): undefined | number

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 (opens in a new tab) 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 (opens in a new tab)

Parameters

ParameterType
logicValueObject?BaseValueObject

Returns

undefined | number

Inherited from

BaseFunction.getZeroOrOneByOneDefault

Defined in

packages/engine-formula/src/functions/base-function.ts:233 (opens in a new tab)


isAddress()

isAddress(): boolean

Returns

boolean

Inherited from

BaseFunction.isAddress

Defined in

packages/engine-formula/src/functions/base-function.ts:157 (opens in a new tab)


isAsync()

isAsync(): boolean

Returns

boolean

Inherited from

BaseFunction.isAsync

Defined in

packages/engine-formula/src/functions/base-function.ts:153 (opens in a new tab)


isCustom()

isCustom(): boolean

Returns

boolean

Overrides

BaseFunction.isCustom

Defined in

packages/engine-formula/src/functions/custom-function.ts:20 (opens in a new tab)


orderSearch()

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

Parameters

ParameterTypeDefault value
valueBaseValueObjectundefined
searchArrayArrayValueObjectundefined
resultArrayArrayValueObjectundefined
searchTypeArrayOrderSearchTypeArrayOrderSearchType.MIN
isDescbooleanfalse

Returns

BaseValueObject

Inherited from

BaseFunction.orderSearch

Defined in

packages/engine-formula/src/functions/base-function.ts:358 (opens in a new tab)


orderSearchExpand()

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

Parameters

ParameterTypeDefault value
valueBaseValueObjectundefined
searchArrayArrayValueObjectundefined
resultArrayArrayValueObjectundefined
searchTypeArrayOrderSearchTypeArrayOrderSearchType.MIN
isDescbooleanfalse
axisnumber0

Returns

undefined | ErrorValueObject | ArrayValueObject

Inherited from

BaseFunction.orderSearchExpand

Defined in

packages/engine-formula/src/functions/base-function.ts:454 (opens in a new tab)


setDefinedNames()

setDefinedNames(definedNames): void

Parameters

ParameterType
definedNamesIDefinedNameMapItem

Returns

void

Inherited from

BaseFunction.setDefinedNames

Defined in

packages/engine-formula/src/functions/base-function.ts:123 (opens in a new tab)


setLocale()

setLocale(locale): void

Parameters

ParameterType
localeLocaleType

Returns

void

Inherited from

BaseFunction.setLocale

Defined in

packages/engine-formula/src/functions/base-function.ts:131 (opens in a new tab)


setRefInfo()

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

Parameters

ParameterType
unitIdstring
subUnitIdstring
rownumber
columnnumber

Returns

void

Inherited from

BaseFunction.setRefInfo

Defined in

packages/engine-formula/src/functions/base-function.ts:165 (opens in a new tab)


setSheetsInfo()

setSheetsInfo(__namedParameters): void

Parameters

ParameterType
__namedParametersobject
__namedParameters.sheetNameMapobject
__namedParameters.sheetOrderstring[]

Returns

void

Inherited from

BaseFunction.setSheetsInfo

Defined in

packages/engine-formula/src/functions/base-function.ts:142 (opens in a new tab)


Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.