Newbies christopher_b Posted June 26, 2006 Newbies Posted June 26, 2006 Greetings, I am trying to work out how to combine a -find with an -edit to avoid a two-step process (a -find followed by an -edit on the recid returned by the find). Basically, I want to edit a record where fieldX=value and pass the new field values (fieldY, fieldZ...) in the same query. The aim is to integrate two systems, so that one can push record edits to a FileMaker database via CWP. I want to avoid the situation where the other system effectively has to find the recid and then issue an -edit command with that recid. Could this be done using an include to do some pre-processing on a token passed in the URL? Has anyone implemented something like this? I'd really appreciate some pointers. Thanks, Chris
Martin Brändle Posted June 26, 2006 Posted June 26, 2006 You need to do two separate transactions, it's not possible otherwise. Well, maybe with a script ( -script=scriptname, pass the values with -script.param), but this would be a separate transaction after the find as well. However, scripts and web transactions should be avoided IMO. Even within FM Pro you are restricted to do separate transactions. The XSLT document() function is your friend here, read p. 61 of the FMSA Custom Web Guide. E.g. within a XSLT stylesheet: Of course you can do similar tests on transaction 1 before you go to transaction 2. If you switch the database, then of course you need also to determine the recid of the record to be change with another document() call.
Newbies christopher_b Posted July 3, 2006 Author Newbies Posted July 3, 2006 Hi Martin, Thanks for your reply. I can see that using document() would help me to achieve my goal, but I've been struggling to figure out how to implement your suggestion. I'd be very grateful if you could show me how to get the values for the variables back and what the general structure of the xslt file would be. I've spent quite a bit of time trying to work it out, but I am still an xslt newbie, so would appreciate a bit more help if possible. Thanks in advance.
Martin Brändle Posted July 3, 2006 Posted July 3, 2006 The important things are already in my example above. Check also the FMSA Custom Web Publishing Guide, chapter 3 and appendix A for how to write an XML or XSLT query. For the general structure of an XSLT file look at my other examples I had posted in this forum; consider also to buy the book by Michael Kay, XSLT Programmer's Reference, Wiley, 2003. It's the XSLT bible. A variable can store a string, a number, an XML tree fragment, or another variable. Variables can just be accessed by writing $ in front of their name, e.g. By way of a document() query to the FileMaker WPE, you store the whole fmresultset XML tree (or another FM XML grammar tree) in a variable Given such a variable, you can just access a single element by using an XPath, e.g. e.g. repetititon 2 of field myfield of record 1 in the resultset of XML root fmresultset of the variable myvariable. or loop through multiple elements, here the records, by or copy part of the tree e.g. record 5 and all its child elements.
Recommended Posts
This topic is 6716 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