Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Queries index of value in object 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\": 1}]" | |
Label | The label for the value in the object to compare. | "key" | |
find | A JSON text or reference to find. | 1 | |
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 item:
MBS( "JSON.FindValueInObjectArray"; "[{\"key\": 1}]"; "key"; 1 )
Example result: 0
Find text:
MBS( "JSON.FindValueInObjectArray"; "[{\"key2\": \"test\"}, {\"key\": 1}]"; "key2"; "\"test\"" )
Find an entry in files array:
Set Variable [ $files ; Value: MBS( "JSON.GetObjectItem"; $content; "files" ) ]
# the string we look for
Set Variable [ $searchFor ; Value: MBS( "JSON.CreateString"; "something/test.jpg") ]
# now look for index in array:
Set Variable [ $index ; Value: MBS( "JSON.FindValueInObjectArray"; $files; "PathName"; $SearchFor) ]
This function checks for a license.
Created 14th December 2018, last changed 4th March 2022