Re: New Feature (now!)
This WebDNA talk-list message is from 2002
It keeps the original formatting.
numero = 42860
interpreted = N
texte = >I think an excellent new WebDNA feature would be [duplicate]. To duplicate a>record now, i have to code all the fields that I want found, and code the>fields to [append]. All this coding will have to be changed should the field>names change. It would be much easier to remove fields I don't want from a>duplicated record.>>Maybe something like this:>[duplicate SKU=[SKU]]SKU=[cart]&date=[date]&time=[time][/duplicate]>where the fields you specify replace the duplicated ones, otherwise all>other fields are duplicated. That sure looks simpler than the reams of code>of doing now!Take the line breaks out of the example code below, then set the theDB' value to the proper name=value path to your db, and it will do exactly what you want to do now -- without waiting for someone at SMSI to create a [duplicate] context.If you put everything in the below example (except the text context) into an include file, it will work for any webcat db that uses a sku field for the unique record identifier value simply by preceding the include tag with the proper text context. Then your code gets very simple, like this:[text]theDB=db=some.db[/text][include file=duplicate]... and if you understand how to pass variables into an include file, you can make your code even simpler by putting nothing more than this into your template every time you want to duplicate a record in any webcat db:[include file=duplicate&theDB=db=some.db]The following code appends a new record with a unique sku value created via the cart tag, then it sets the formvariable values in the new record (except for sku which has already been set), then it sets the remaining listfields values which have not already been set. Of course this work because (as you know) in append and replace contexts, webcat only sets the FIRST occurrence of a value assigned to a field name, then it ignores any others having the same field name:[text]theDB=db=some.db[/text][append [theDB]]sku=[cart]&[formvariables][name]=[url][value][/url]&[/formvariables][search [theDB]&eqskudatarq=[url][sku][/url]&max=1][founditems][listfields [theDB]][fieldname]=[url][interpret][[fieldname]][/interpret][/url]&[/listfields][/founditems][/search][/append]And if your form has a field in it for every field in the db -- and if you are populated the form by searching for and retrieving the one record you wish to duplicate (which seems to be the most effective way to do what you want to do) -- then you can skip the entire search context and everything inside it, and instead you can use nothing more than this code (after removing the new line characters of course):[text]theDB=db=some.db[/text][append [theDB]]sku=[cart]&[formvariables][name]=[url][value][/url]&[/formvariables][/append]Sincerely,Kenneth Grome---------------------------------------------------WebDNA Professional Training and Development Center175 J. Llorente Street +63 (32) 255-6921Cebu City, Cebu 6000 kengrome@webdna.netPhilippines http://www.webdna.net----------------------------------------------------------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list
.To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
Associated Messages, from the most recent to the oldest:
>I think an excellent new WebDNA feature would be [duplicate]. To duplicate a>record now, i have to code all the fields that I want found, and code the>fields to [append]. All this coding will have to be changed should the field>names change. It would be much easier to remove fields I don't want from a>duplicated record.>>Maybe something like this:>[duplicate SKU=[SKU]]SKU=[cart]&date=[date]&time=[time][/duplicate]>where the fields you specify replace the duplicated ones, otherwise all>other fields are duplicated. That sure looks simpler than the reams of code>of doing now!Take the line breaks out of the example code below, then set the theDB' value to the proper name=value path to your db, and it will do exactly what you want to do now -- without waiting for someone at SMSI to create a [duplicate] context.If you put everything in the below example (except the text context) into an include file, it will work for any webcat db that uses a sku field for the unique record identifier value simply by preceding the include tag with the proper text context. Then your code gets very simple, like this:[text]theDB=db=some.db[/text][include file=duplicate]... and if you understand how to pass variables into an include file, you can make your code even simpler by putting nothing more than this into your template every time you want to duplicate a record in any webcat db:[include file=duplicate&theDB=db=some.db]The following code appends a new record with a unique sku value created via the cart tag, then it sets the formvariable values in the new record (except for sku which has already been set), then it sets the remaining listfields values which have not already been set. Of course this work because (as you know) in append and replace contexts, webcat only sets the FIRST occurrence of a value assigned to a field name, then it ignores any others having the same field name:[text]theDB=db=some.db[/text][append [theDB]]sku=[cart]&[formvariables][name]=[url][value][/url]&[/formvariables][search [theDB]&eqskudatarq=[url][sku][/url]&max=1][founditems][listfields [theDB]][fieldname]=[url][interpret][[fieldname]][/interpret][/url]&[/listfields][/founditems][/search][/append]And if your form has a field in it for every field in the db -- and if you are populated the form by searching for and retrieving the one record you wish to duplicate (which seems to be the most effective way to do what you want to do) -- then you can skip the entire search context and everything inside it, and instead you can use nothing more than this code (after removing the new line characters of course):[text]theDB=db=some.db[/text][append [theDB]]sku=[cart]&[formvariables][name]=[url][value][/url]&[/formvariables][/append]Sincerely,Kenneth Grome---------------------------------------------------WebDNA Professional Training and Development Center175 J. Llorente Street +63 (32) 255-6921Cebu City, Cebu 6000 kengrome@webdna.netPhilippines http://www.webdna.net----------------------------------------------------------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
Kenneth Grome
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Help name our technology! (1997)
Version Question (2000)
WebCatalog for guestbook ? (1997)
Webcat Manual and TeaRoom Examples Uses Different Examples. (1997)
Passing Cart variable to subdirectory files? (1997)
SQL statements (2002)
Summing fields (1997)
Help with nested search (1998)
Trouble with Netscape (1998)
Web Catalog vs. ICAT (1997)
[WebDNA] read database from other domain (2015)
It just Does't add up!!! (1997)
About WebDNA (2006)
problems with WebCat-Plugin (1997)
Image as submit button (2000)
WebCat2b14MacPlugIn - [include] doesn't hide the search string (1997)
Snake Bites (1997)
GoLive CyberStudio 1.0.1 (1997)
WebCat2 Append problem (B14Macacgi) (1997)
What's up with digger? (2004)