Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Data Parsing & Duplicate Checking Using XSL


This topic is 6676 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi,

Couple of problems I'd like ideas and suggestions for please...

Firstly... I've got an XSL styleheet that imports xml data in the FMPDSORESULT format into FMPXMLRESULT and sucessfully create records in a FileMaker database.

I'd like to know how to change data elements using xslt before they get to FileMaker. I have a date formatted in the xml doc as yyyy-mm-dd. This is obviously not going to play well with FileMaker's default dd/mm/yyyy format. How can I change the format of the data using my stylesheet so that it swaps things round and inserts the /'s?

Secondly, how can I get xsl to check and ignore any duplicate records? All records have a unique ID but at the moment they are all imported regardless of duplicates.

Any help and ideas appreciated.

Andy

Posted (edited)

Not sure whether there are any actual date functions in xsl; they'd likely be in an "extended" xsl. There is some recent news about this; but I can't remember where I read it. Maybe Beverly Voth (or Martin) could set us straight, when she gets back. There are string functions. So you could swap stuff around. But it would likely be easier to just import into a FileMaker text field, and use FileMaker Text functions.

As far as the duplicates, you could use the Import Matching option, with a match on the ID. That works with xml import.

Edited by Guest
or Martin :-]
Posted

Hi Fenton,

Thanks for the reply :smile2:

I'd thought about using FM to move the date elements around once in FileMaker but this would need to either be scripted and looped or require a calc field. Just easier to get the xsl to do it on the import.

Anyway, I've been having a play and have it sorted using the following:

:yep:

Regarding the duplicates, I take it you mean import matching on the FileMaker import script step? If so, I've got this setup already but it will still initially import two or more duplicates that exist in the original xml doc. Once they are imported into FileMaker it works fine and doesn't create a new record. There shouldn't be duplicates in the xml document *but* you never know.

So is there a way to set the xsl to check the original xml doc and ignore any duplicate entries?

Cheers,

Andy

Posted

I don't know how you could get the xsl to eliminate the xml's duplicates. There may be a way, but it would be pretty esoteric. I think I'd stick with FileMaker on that one.

Posted

Hi Martin,

Thanks for the reply.

The duplicate checking is done using a unique pupil number UPN.

I've inserted

followed by

Seems like it should do the trick but no error is returned by FileMaker and no records are imported either! Without the count function it works fine so I'm assuming it's returning a count of 0.

The xml tree is:

(child of Pupil and should be unique for every record)

(child of Pupil)

(child of SchoolHistory with possible multiple values)

Any ideas?

This topic is 6676 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.