PropertyManager ( list ; name ; value ; action )
Custom function to manage propertylists
Average rating: 4.3 (33 votes) Log in to vote
Reinder Wolting ABECON http://www.abecon.nl |
PropertyManager ( "¶b=2¶" ; "a" ; "1" ; 1 )
PropertyManager ( "¶a=1¶b=2¶" ; "a" ; "4" ; 2 )
PropertyManager ( "¶a=1¶b=2¶" ; "a" ; "" ; 3 )
"¶a=1¶b=2¶"
"¶a=4¶b=2¶"
"¶b=2¶"
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Custom function to manage propertylists
You can add, replace or delete properties form the list or get is value.
This functions assumes that a list looks like this: ¶name1=value1¶name2=value2¶name3=value3¶...
Parameters:
list: the propertylist
name: the propertyname
value: the new value of the property
action: what to do; 0 stands for get, 1 for add, 2 for replace and 3 for delete
Comments
Serge Apr 22, 2022 |
||
Thanks Reinder! I've added a small fix in the version I use as it seems there's a little bug if you do an Add (e.g. name A, value 1) then another Add with same name A and value 2, your proposed code doesn't seem to do a replace (so you end up with 2 values A (A=1¶A=2 instead of A=2). So I now have replaced: If ( xPosition ; Replace ( list ; xStart ; xLength ; value ) ; list & name & "=" & value & "¶" ) ; // add by: If ( xPosition ; Replace ( list ; xStart ; xLength ; value ) ; list & if ( list = "" ; "¶") & name & "=" & value & "¶" ) ; // add PS: Also it seems current version of FileMaker doesn't like to use "list" as a parameter anymore (reserved word?) so I have renamed that too. Hope this helps. |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.