Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
12.1
12.2
12.3
12.4
12.5
13.0
13.1
13.2
13.3
13.4
Statistic
FMM
Blog
Queries index of value in array.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
JSON | 9.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
json | A JSON text or reference. | {"key": "value"} | |
find | A JSON text or reference to find. | {"key": "value"} | |
byContent | Compare JSON by content, so number can be found via text. Default is 0, so type counts first. |
1 | Optional |
StartIndex | Available in MBS FileMaker Plugin 11.5 or newer. Index of first element to check. Zero if not specified. If you like to continue searching, you can pass last result + 1. |
0 | Optional |
Returns index or error.
Find value in an array of numbers:
MBS( "JSON.FindValueInArray"; "[5,6,7,1,4,3,7]"; 3)
Example result: 5
Find text:
MBS( "JSON.FindValueInArray"; "[\"Hello\", \"World\", \"Test\"]"; "\"World\"")
Example result: 1
Find objects:
MBS( "JSON.FindValueInArray"; "[{\"Hello\":123}, {\"World\":234}, {\"Test\":345}]"; "{\"World\":234}")
Example result: 1
Find the apple:
MBS( "JSON.FindValueInArray";
// some json with an emoji
"[\"Test\",\"🍎\",\"Other\"]";
// and we can find it with unicode escape (or by passing the emoji again)
"\"\uD83C\uDF4E\"")
This function checks for a license.
Created 14th December 2018, last changed 31st January 2023