FossilFM Posted April 20, 2005 Posted April 20, 2005 Hi All, I'm looking into adding a -script argument to one of my web request which is a -find. What I would like is if the -find returns no record I'd like for the -script that i call to actually create the record that was initial looked for. Currently when I do a -script with a -find that doesn't return any records, i still get the no records found error in the XML returned. Is there a way to create the record in the script that is called then return the newly created record as the found result? Thanks.
Martin Brändle Posted April 20, 2005 Posted April 20, 2005 For CWP, see this thread and the example download there. You don't need a -script for that. Martin
FossilFM Posted April 21, 2005 Author Posted April 21, 2005 Hi Martin, Wanted to know if I understood this correctly. So the user makes a request using the stylesheet multiple.xsl which just contains the form. The form is then submitted to FileMaker Server which then returns either a result or no records found which will use the stylesheet multiple2.xsl. Now in multiple2.xsl, if no records are found, multiple2.xsl makes a request using multiple3.xsl which will simlply relay the message requested by multiple2.xsl then use multiple.xsl to display the result. I think I understood it correctly? I guess I overlooked the fact that a -script will only work on the records that are found or returned based on a request such as a successful -find or -new or -edit. On a different note, since they say that server advanced is now multiple threaded, does that mean a reqest with a -script will no longer block the requeset of say a -find or -new? I'm assuming that FileMaker has taken care of thread issues of simultaneous request with -script that may alter the same record. Thanks again for your help and sample project file.
Martin Brändle Posted April 21, 2005 Posted April 21, 2005 Hi Martin, Wanted to know if I understood this correctly. So the user makes a request using the stylesheet multiple.xsl which just contains the form. The form is then submitted to FileMaker Server which then returns either a result or no records found which will use the stylesheet multiple2.xsl. Now in multiple2.xsl, if no records are found, multiple2.xsl makes a request using multiple3.xsl which will simlply relay the message requested by multiple2.xsl then use multiple.xsl to display the result. I think I understood it correctly? Yes. But look at my comments beginning on line 56 in multiple2.xsl. You can even do that with two files only, if you use the XSLT document() function. I guess I overlooked the fact that a -script will only work on the records that are found or returned based on a request such as a successful -find or -new or -edit. On a different note, since they say that server advanced is now multiple threaded, does that mean a reqest with a -script will no longer block the requeset of say a -find or -new? I'm assuming that FileMaker has taken care of thread issues of simultaneous request with -script that may alter the same record. Frankly, in my old CDML days , I never needed -script and always tried to circumvent it, because I felt that interaction between scripts in FM Unlimited and the Web Companion was too loose. In the fmwebtalk list there was once a large discussion on the pros and cons of using -script. There was the observation that long scripts could be interrupted if, when the script was still busy, another web request came in. You had to take special measures (e.g. Allow User Abort off/on and error checking) to prevent that. In my opinion it was simply not performant enough. So I used FMP-InlineActions and similar stuff. I keep that opinion for XML/XSLT CWP: To avoid -script whenever possible, instead use calculation fields, the functions of XSLT or the fmxslt extensions.
FossilFM Posted April 22, 2005 Author Posted April 22, 2005 Hi Martin, I also try to avoid using -script particularly during FM 6 days. The reason I am looking into -script right now is because it is no longer tied to the UI of FileMaker and more importantly is trying to figure how to create a set of related records when the user creates a new parent record request. What I would like it to be able to create a set of related records when the user makes a new parent record request. The related records can vary in number. Unless you have a better idea in creating related records ?
Martin Brändle Posted April 22, 2005 Posted April 22, 2005 Look again at the document() function, which is the analogue for the good old CDML tag FMP-InlineAction. You could do a <xsl:for-each select="..."> ... </xsl:for-each> and within this loop call the document() function with <xsl:variable name="..." select="document(...)"/> I use that in a solution, and it works like a charm, and even faster than FMP-InlineAction.
Recommended Posts
This topic is 7155 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