Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 9.0   9.1   9.2   9.3   9.4   9.5   10.0   10.1   10.2   10.3    Statistic  

Addressbook.multivalue.replaceValueAtIndex

Replaces the value at the given index.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Addressbook 3.1 Yes No No No Yes
MBS( "Addressbook.multivalue.replaceValueAtIndex"; index; value )   More

Parameters

Parameter Description Example value
index The index of the value that will be replaced. $index
value The new value. $value

Result

Returns OK on success and error on failure.

Description

Replaces the value at the given index.

Examples

Replace an email:

# find my ID
Set Variable [$personID; Value:MBS( "Addressbook.me" )]
# get email list
Set Variable [$r; Value:MBS( "Addressbook.record.valueForProperty"; $personID; "EmailProperty" )]
# show first email in list
Set Variable [$firstValue; Value:MBS( "Addressbook.multivalue.valueAtIndex"; 0 )]
Show Custom Dialog ["First Email"; $firstValue]
# replace first email with new email
Set Variable [$r; Value:MBS( "Addressbook.multivalue.replaceValueAtIndex"; 0; "test@test.test" )]
# show changed email
Set Variable [$firstValue; Value:MBS( "Addressbook.multivalue.valueAtIndex"; 0 )]
Show Custom Dialog ["First Email"; $firstValue]
# set back the email list
Set Variable [$r; Value:MBS( "Addressbook.record.SetValueForProperty"; $personID; "EmailProperty"; "" )]
# save it
Set Variable [$r; Value:MBS( "Addressbook.save" )]
Show Custom Dialog ["Saved"; $r]

Replace an address:

# Find someone...
Set Variable [ $personID ; Value: MBS( "Addressbook.searchPeopleWithName"; "Jon"; "Test" ) ]
If [ Length($personID) > 0 ]
    # set Address
    Set Variable [ $r ; Value: MBS( "Addressbook.record.valueForProperty"; $personID; "AddressProperty" ) ]
    Set Variable [ $r ; Value: MBS( "Addressbook.multivalue.replaceValueAtIndex"; 0; "Street=5th avenue¶Zip=12345¶Country=USA¶City=New York" ) ]
    Set Variable [ $r ; Value: MBS( "Addressbook.record.SetValueForProperty"; $personID; "AddressProperty"; "multivalue" ) ]
    Set Variable [ $r ; Value: MBS( "Addressbook.save" ) ]
    # get Address and show
    Set Variable [ $r ; Value: MBS( "Addressbook.record.valueForProperty"; $personID; "AddressProperty" ) ]
    Set Variable [ $Address ; Value: MBS( "Addressbook.multivalue.valueAtIndex"; 0) ]
    Show Custom Dialog [ "Address" ; $Address ]
End If

See also

Blog Entries

Created 18th August 2014, last changed 9th December 2019


Addressbook.multivalue.replaceLabelAtIndex   -   Addressbook.multivalue.setPrimaryIdentifier

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins