slehar Posted October 15, 2010 Posted October 15, 2010 Hi guys, I wrote an AppleScript that calls a FileMaker script that imports data records from an xml file, with lots of help from this forum! (Thanks!) Now I discover that the xml data (provided by another program) does not always have the same fields. Specifically, some of the fields may be missing (depending on options in the generating program). For example a record may contain: Field1 Field2 Field3 Field6 Field7 with fields 4 and 5 missing from this record. FileMaker simply imports the data from fields 6 and 7 into the slots that were supposed to be for the missing fields 4 and 5. This is perfectly understandable for a {comma,separated,list,} but I'm importing from an xml file that has all the fields named and data-typed! Is there a way to tell FileMaker (in a script) to import the data only to fields with matching field names? Isn't that the whole idea of going with xml data instead of {comma,separated,lists}? I found a "View by Matching Names" option in an import dialog, but can this also be done scriptually?
comment Posted October 16, 2010 Posted October 16, 2010 Not sure where AppleScript comes into this. If you are importing XML using a XSLT stylesheet, you can have the stylesheet present a constant list of fields for Filemaker to import. If some of the fields are missing from the source XML, it will appear as if they were present and empty.
slehar Posted October 18, 2010 Author Posted October 18, 2010 If you are importing XML using a XSLT stylesheet, you can have the stylesheet present a constant list of fields for Filemaker to import. If some of the fields are missing from the source XML, it will appear as if they were present and empty. That sounds great. But I already wrote a Python script that writes the data in the xml import file, and it already writes it in format, so if I used a stylesheet, all I would need it for would be to ensure that missing fields are represented with empty data. How would I do that in a stylesheet, if my file is already in format? (My Cologon: FMP Bible says almost nothing about this subject)
comment Posted October 18, 2010 Posted October 18, 2010 I already wrote a Python script that writes the data in the xml import file, and it already writes it in format Well, a stylesheet does practically the same thing, so I believe all you need to do is modify your script to (a) write always a constant set of fields in the section, and ( represent any missing fields by an empty element in the section.
Recommended Posts
This topic is 5149 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