Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Data Parsing & Duplicate Checking Using XSL

Featured Replies

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

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 :-]

  • Author

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

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.

What is the criterion for checking for duplicates? Some record id element?

You might consider http://www.dpawson.co.uk/xsl/sect2/N2696.html for a hint on removing duplicates with XSLT.

  • Author

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?

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.