Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version r096

D toc

Excerpt

Computes the index at which a specified element is first found within an array, when searching right to left. Returned value is based on left-to-right indexing.

  • Leftmost index value is 0. Rightmost index value is the same value returned by ARRAYLEN function.
  • If the element is not found, null is returned.
  • For left-to-right searching, use ARRAYINDEXOF. 
    • If only one element exists in the array, both functions return the same value.
    • For more information, see ARRAYINDEXOF Function.

D s lang vs sql

D s
snippetBasic

Array literal reference example:

D lang syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:arrayrightindexof(["A","B","C","D"],"C")

arrayrightindexof(["A","B","C","D"],"C")

Output: Returns the right-index of the element "C" in the array, which is 2 in an 0-based index from left to right

Column reference example:

D lang syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:arrayrightindexof([myValues],myElement) as:myRightIndexOfmyValues'

arrayrightindexof([myValues],myElement)

Output: Returns the right-search in the myValues arrays for the elements listed in the myElement column.

D s
snippetSyntax

D lang syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextderive type:single value:arrayrightindexof(array_ref,my_element)

arrayrightindexof(array_ref,my_element)


ArgumentRequired?Data TypeDescription
array_refYarray or stringName of Array column, Array literal, or function returning an Array to apply to the function
my_elementYanyThe element to locate in the array, searching from right to left

D s lang notes

array_ref

Name of the array column, array literal, or function returning an array whose element you want to locate.

  • Multiple columns and wildcards are not supported.

D s
snippetusage

 

Required?Data TypeExample Value
YesString (column reference or function) or array literalmyArray1

my_element

Element literal that you wish to locate in the array. It can be a value of any data type.

D s
snippetusage

 

Required?Data TypeExample Value
YesAny"1st"

D s
snippetExamples

Example - Computing points based on position of finish

Include Page
EXAMPLE - ARRAYINDEXOF and ARRAYRIGHTINDEXOF Functions
EXAMPLE - ARRAYINDEXOF and ARRAYRIGHTINDEXOF Functions

D s also
labelnested