GetFieldsAsXML ( theFields )
Convert a list of fields to XML data
Average rating: 4.4 (33 votes) Log in to vote
Andy Knasinski - Show more from this author
nrg software, llc. http://www.nrgsoft.com |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
// Description:
// GetFieldsAsXML ( theFields )
// A recursive function that takes a list of field names
// and returns an XML string with the field values
// note that alphanumeric field names should be used in order to produce valid XML
Comments
Bruce Robertson Jan 20, 2012 |
||
Are the pipe and shift-space encodings correct? And what is their purpose? | ||
Christoph Kaufmann, CLK.ch Oct 8, 2013 |
||
// modified to allow for empty fields (self closing tag <field/>) If ( IsEmpty ( theFields ); theFields; Let ( [ attribute = GetValue ( theFields ; 1 ) ; xmlString = Substitute ( GetField (attribute) ; [ "|";" " ] ; // pipe [ " ";" " ] ; // shift-space [ "&" ; "&" ] ; [ "<" ; "<" ] ; [ ">" ; ">" ] ; [ "\"" ; """ ] ; [ "'" ; "'" ] ) ] ; // End of the definitions // Self closing tag if xmlString is empty: If ( IsEmpty ( xmlString ) ; "<" & attribute & "/>" ; // else open and close tag "<" & attribute & ">" // open tag & xmlString // content & "</" & attribute & ">" // close tag ) // Ende If & // starting over with the next field If ( ValueCount ( theFields ) > 1 ; "¶" ; "" ) & GetFieldsAsXML ( RightValues ( theFields ; ValueCount ( theFields ) - 1 ) ) // End If ) // End Let ) // End of the initial If |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.