Jump to content

delete record with XSLT


Brian Paquin

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

Recommended Posts

Converted CDML solution to XSLT using CDML Converter...

The solution includes a (URL) link for deleting a user,

but the user (record) is never deleted. Any ideas?

mywebsite.org/fmi/xsl/addusers/delsuccess.xsl?&-db=newusers&-lay=General&-recid=1254&-grammar=fmresultset&-delete

There are no errors, and the delsuccess file returns properly.

Please help!

Brian

Link to comment
Share on other sites

Ooopps! Thanks for catching that extra ampersand!

But this link, STILL, doesn't delete a record:

mywebsite.org/fmi/xsl/addusers/delsuccess.xsl?-db=newusers&-lay=General&-recid=1268&-delete

But, following the CWP manual, using this link DOES work:

mywebsite.org/fmi/xml/fmresultset.xml?-db=newusers&-lay=General&-recid=1268&-delete

However, the manual does not state how to get a return page

(so I can notify the user that the record has been deleted) ??

How do I get a return page? Like what the XSLT solution was providing?

Brian

Link to comment
Share on other sites

No, it works also with XSLT publishing. But I needed some time to create a working test. And it was a good question to deal with the "magic" of FileMaker XSLT Publishing.

Try

http://www.clicaps2.ethz.ch/fmi/xsl/test...ay=WWW&-findall

Then click on the "add a record" link.

Then, on the resulting page, click on any "delete record" link, which deletes a record and sends you back to the originating page.

The db and the two XSLT files are attached in this post. Please study them. There are some special techniques in the XSLT like

- variables

- doing searches within the XSLT file with the document() function. In CDML, this corresponds to [FMP-InlineAction: ...], however, document() is much more flexible, and you can save its result in a variable

- concatting strings with concat()

- adding the current time to the URL so that the browser always loads the page from the server and not from its cache

There might be one reason why in your case the record is not deleted: The value for the recid that you use in the query does not correspond to the record-id, an internal database value of the record you want to address. You can get this value from the XML fmresultset tree, see line <xsl:variable name="recordid" select="$record/@record-id"/> in test_delete.xsl

Another feature is, that the resulting XSLT stylesheet always processes the XML result tree from the last action. E.g. if the action was -delete, the FileMaker XML result is empty (well it has some database metadata, still), of course, because the record was deleted. Therefore, if one wishes, one has to re-query the remaining records in the database with the document() function.

You can trace that in my example in the two XML result trees at the bottom of the page.

Martin

test_delete.zip

Link to comment
Share on other sites

Martin,

May I say that you went above and beyond here?

Thank you SO MUCH!! I am overwhelmed...

(to get so much support here, and so little help from FileMaker Support)

(I'm not blaming them... just wish they would offer fee-based custom solutions support)

The issue WAS with the resulting stylesheet!

I really need to learn more about XML/XSLT...

Thank you (once again) Martin.

Brian

Link to comment
Share on other sites

This topic is 7074 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.