Plug-ins > Address Book Manipulator

PCAB_Search *sometimes* returns string

(1/1)

john.christopher:
PCAB_Search is supposed to return a count of the matching found set from Address Book.  I just installed it on a client's computer and found my scripts would only sync 2 out of 2022 contacts.  I had a simple loop:


--- Code: ---Set Variable [$itemCount; PCAB_Search ( "Person" ; "Modified Date" ; "" ; "" ; "GreaterThan" ; $afterTimestamp ; "" )]

If [$itemCount > 0]
    Set Variable [$updatedAppleUids; Let ( $i = 1 ; PCAB_OpenFirstRecord )]
End if

Loop
    Exit Loop If [Let ( $i = $i + 1 ; If ( $i > $itemCount ; Let ( $i = Null ; True ) ) )]
    Set Variable [List ( $updatedAppleUids ; PCAB_OpenNextRecord )
End Loop
--- End code ---

As it turns out, if $itemCount = 2022, then $i > $itemCount when $i = 2.  Two.

It turns out that PCAB_Search will return a string, and FileMaker will cast the $i to string to match, so when $i = 2, then "2" > "2022", and the loop terminates.

This one cost me some time.  I have to wrap PCAB_Search in GetAsNumber().  This is undocumented and unexpected behavior.

Jerel Malong:
Thank you for the information. I have passed this information along to our plug-in developer. Have you noticed the same behavior with other functions as well?

Navigation

[0] Message Index

Go to full version