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 Center 175 J. Llorente Street +63 (32) 255-6921 Cebu City, Cebu 6000 kengrome@webdna.net Philippines 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:

    
  1. Re: New Feature (now!) (Gary Krockover 2002)
  2. Re: New Feature (now!) (Kenneth Grome 2002)
>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 Center 175 J. Llorente Street +63 (32) 255-6921 Cebu City, Cebu 6000 kengrome@webdna.net Philippines 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:

Running _every_ page through WebCat ? (1997) Message Boards (2003) too many nested [xxx] (1997) WebDNA Quick Reference (Reserved Words) (2000) WebCatalog2 Feature Feedback (1996) serial number dishing (1997) webcat- multiple selection in input field (1997) Did you hear about this? (1997) [numFound] inside [showIf]? (2000) Signal Raised (1997) latest version? (1998) Why isn't this working (1999) Trunk-gator (1997) Searching,Brain Dead! (1999) [WebDNA] Version 7.x: webdna.ini and EmailerPrefs (2012) WebCatb15 Mac CGI -- [purchase] (1997) Chown www:wheel Almost There WebCat 5 on itools 7 (2003) problems with 2 tags shakur (1997) Exclamation point (1997) Keep away (1997)