Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

List.IndexOfFirstValueMatching

Finds index of first value matching value.

Component Version macOS Windows Linux Server iOS SDK
List 10.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "List.IndexOfFirstValueMatching"; List; Operator; Value { ; Mode; StartRow } )   More

Parameters

Parameter Description Example Flags
List The list to process. "Hello" ¶ "" ¶ "World"
Operator The compare operator.
Can be =, !=, <, >, <=, >=, ≤, ≥, ≠, Prefix or Postfix.
"≥"
Value The value to compare. "Test"
Mode Available in MBS FileMaker Plugin 10.3 or newer.
Pass 1 for numeric comparison.
Default is 0 for text comparison.
0 Optional
StartRow Available in MBS FileMaker Plugin 14.0 or newer.
The row to start at.
Default is 0.
0 Optional

Result

Returns number or error.

Description

Finds index of first value matching value.
This uses text comparison!

Examples

Find the value =2:

MBS( "List.IndexOfFirstValueMatching"; "1¶2¶3¶4"; "="; 2 )

Example result: 1

Find the value ≥3

MBS( "List.IndexOfFirstValueMatching"; "1¶2¶3¶4"; ">="; 3 )

Example result: 2

Find hello as prefix:

MBS( "List.IndexOfFirstValueMatching"; "test¶hello_123¶audi 34"; "prefix"; "hello" )

Example result: 1

Find next one in a list:

Let(
    [
        // you have a list
        list = "132430¶132433¶132437¶132445¶132447¶132450¶132463¶132464¶132465¶132466¶132468¶132469¶132470¶";

        // find a value
        index = MBS( "List.IndexOfFirstValueMatching"; list; "="; 132450; 1);

        // now pick one after it:
        nextValue = MBS( "List.GetValue"; List; index + 1)
    ];
    nextValue
)

See also

Release notes

Blog Entries

This function checks for a license.

Created 5th April 2020, last changed 21st November 2023


List.HasValue - List.InsertValue