よく使う配列処理関数

  • 作成者:ayuan0625
  • 編集回数:6次
  • 最終更新:FRInternational 于 2021-03-29
  • I. INDEXOFARRAY

    INDEXOFARRAY(array,index): Returns the index element of the array.

    array: Need to return an array of elements.

    index: The index of the array element.

    Example

    INDEXOFARRAY(["first","second","third"],2) returns "second".

    Enter =indexofarray(["a","b","c","d"],3) in the cell to get the data at the third position in the array, that is, the return value is c.

    II. INARRAY

    INARRAY(co,array): Returns the position of co in the array. If co is not in the array, it returns 0.

    co: The character whose position in the array needs to be judged.

    array: array.

    Example

    Enter =inarray("b",["a","b","c","d"]) in the cell. The position of b in the array is 2, so the return value is 2.

    Enter =inarray("e",["a","b","c","d"]) in the cell. Since e is not in the array, the return value is 0.

    III. GREPARRAY

    GREPARRAY(array, fn): The function (returns true or false) is the condition, filters this array, and finally forms a new array.

    array: array.

    fn: The condition of the filtered field.

    Example

    GREPARRAY([3,4,2,3,6,8,7],item!=3) is equal to [4,2,6,8,7].

    Enter =greparray([3,4,2,0,6,8,0], item != 0) in the cell to return a new array [3,4,2,6,8].

    IV. MAPARRAY

    MAPARRAY(array,fn): Convert the items in one array to another array.

    array(Array): The array to be converted.

    fn(Function): A function for processing array items.

    Example

    MAPARRAY([3,4,2,3,6,8,7],item!=3) is equal to [false,true,true,false,true,true,true].

    Enter =maparray([3,4,2,-3,6,8,-5],if(item>0,1,0)) in the cell, and return a new array [1,1,1, 0,1,1,0].

    V. SORTARRAY

    SORTARRAY(array): Returns the sorted array of the array.

    array: The array to be sorted.

    Note: The element types of array must be the same and must be comparable.

    Example

    SORTARRAY([3,4,4,5,1,5,7]) returns [1,3,4,4,5,5,7].

    Enter =sortarray([3,4,4,5,1,5,7]) in the cell to return a new array [1,3,4,4,5,5,7].

    Attachment List


    Theme: FineReport 帳票実例
    既に最初
    既に最後
    • Helpful
    • Not helpful
    • Only read