stuj1026 Posted December 3, 2009 Posted December 3, 2009 Hi Everyone! I'm back with another problem I am setting a global field using the function (GetFieldasXML) which I downloaded from the Brian Dunning website. It generates something that looks like this into the global field based on the fields on the layout using the list fields function. Generated output 2 3 44 1234number> 12/1/2009 11/7/8854to format> 17of fields> frefile> dav dan 3508.8 123.50 test 3physicians::grpnum> ------------------------------------------------------------------------------ here is the custom function Function Name = GetFieldsAsXML Parameter = theFields -------------------------------------------- If ( IsEmpty ( theFields ); theFields; Let ([attribute = GetValue ( theFields ; 1 ); xmlString = Substitute(GetField (attribute); ["|";" "]; /* pipe */ [" ";" "]; /* shift-space */ ["&";"&"]; ["<";"<"]; [">";">"]; [""";"""]; ["'";"'"] )] ; "<" & attribute &">" & xmlString & "" & attribute & ">" & If ( ValueCount ( theFields ) > 1 ; "¶" ; "" ) & GetFieldsAsXML ( RightValues ( theFields ; ValueCount ( theFields ) - 1 ) ) ) ) ------------------------------------------------------------------------ I need to strip away the relationship name from the output ie: 123.50 should be 123.50 3physicians::grpnum> should be 3 ------------------------------------------------------------------------ is it possible to modify the above custom function to do this or another recursive function to strip away the relationship name!! It's tricky and above my expertise! Can anyone help I need this to be in a recursive function as I will be using this on many different layouts and the substitute function just wont work. Thanks in advance Stu
stuj1026 Posted December 3, 2009 Author Posted December 3, 2009 I have a number of files I create the xml in file [A] and then pass this as a parameter to another file with the same field names. I then use an extract function that we wrote to set the fields in file with the xml from fie [A] by looping thru the xml, getting the field name on each line and then set the corresponding field in file [A] We then ship this xml to various vendors who use this same format but are not using filemaker.. That's pretty much the short answer. We are creating the xml now by using a pretty long and complicated script that seems to work when I came across the custom function and realize we could probably do this in 1 or 2 custom functions. Thanks again Stu
comment Posted December 3, 2009 Posted December 3, 2009 To transfer data into another Filemaker file, couldn't you simply import it? And why is it necessary to keep the same data in two files anyway? To get data out in XML format, its best to export as XML using a custom XSLT styleheet to transform it into the target XML schema.
stuj1026 Posted December 4, 2009 Author Posted December 4, 2009 Thats true but the 2 vendors that we transfer this data to uses, the exact format as stated above. Our solution is quite large and we have found that transfering the data in this fashion to be the most efficient way. Thanks Stu
comment Posted December 4, 2009 Posted December 4, 2009 the 2 vendors that we transfer this data to uses, the exact format as stated above. As I said, a XSLT stylesheet can be used during XML export to transform the output into the desired format. I believe it's much more efficient than fiddling with XML in calculations. BTW, it would be trivial to modify the custom function, esp. when given your previous thread: http://fmforums.com/forum/showtopic.php?tid/212332/
Recommended Posts
This topic is 5479 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now