Replaces each found record in a database with the new field values.
numero = 211To replace records in an ODBC-compliant table controlled by a SQL server, use the [SQL] context.
To replace field values of records in a database, put a [replacefounditems] context into a template inside a [search] context. As each matching record is found, that record's fields inside the [ReplaceFoundItems] context are replaced with new values.[index] | A number indicating this record's placement in the list. Note that this number is not taken from the database, but is purely a counter as the records are retrieved. |
[search db=base.db&neRefdata=0&Refsort=1][replacefounditems]Ref=[index][/replacefounditems][/search]
this context is much faster than the old technique of nesting a [replace] context inside a [founditems] context. For example: if you currently use something like this to modify many records in a database...
[search db=xx.db&neSKUdata=0][founditems][replace db=xx.db&eqSKUdata=[sku]]value=[math][value]+1[/math][/replace][/founditems][/search]...then you can change it to the following in order to speed it up considerably:
[search db=xx.db&neSKUdata=0][replacefounditems]value=[math][value]+1[/math][/replacefounditems][/search]Example:
[search db=products.db&neSKUdata=0][replacefounditems]price=[math][price]*1.1[/math][/replacefounditems][/search]In the example above, the database "products.db" opens, all records whose sku field is not "0" found, and each of those found record's price fields incremented by 10%. As each found record is visited, that record's field values are available inside the context so you can use them to compute new values.
This behavior is very different from the simpler [replace] context, which replaces all found items with the same value.
Any fieldnames that do not exist in the database are ignored, and if you leave some existing fieldnames out of the replace context, they will remain unchanged in the database. Certain letters are illegal, such asYou may specify an absolute or relative path to the database file, as in "/WebCatalog/GeneralStore/somebase.db" or "../somebase.db". You may also place "^" in front of the database path to indicate that the file can be found in a global root folder called "Globals" inside the WebCatalogEngine folder.
Contrast between [replacefoundItems] and [replace] | |||||
---|---|---|---|---|---|
[search db=products.db&neSKUdata=0][replacefoundItems]price=[math][price]*1.1[/math][/replacefoundItems][/search] | [replace db=products.db&neSKUdata=0]price=10[/replace] | ||||
SKU | price before | price after | SKU | price before | price after |
1 | 5 | 5.5 | 1 | 5 | 10 |
2 | 10 | 11 | 2 | 10 | 10 |
3 | 15 | 16.5 | 3 | 15 | 10 |
4 | 20 | 22 | 4 | 20 | 10 |
5 | 35 | 38.5 | 5 | 35 | 10 |
To replace records in an ODBC-compliant table controlled by a SQL server, use the [SQL] context.
[index] | A number indicating this record's placement in the list. Note that this number is not taken from the database, but is purely a counter as the records are retrieved. |
[search db=base.db&neRefdata=0&Refsort=1]
[replacefounditems]Ref=[index][/replacefounditems]
[/search]
this context is much faster than the old technique of nesting a [replace] context inside a [founditems] context. For example: if you currently use something like this to modify many records in a database...
[search db=xx.db&neSKUdata=0]
[founditems]
[replace db=xx.db&eqSKUdata=[sku]]value=[math][value]+1[/math][/replace]
[/founditems]
[/search]
[search db=xx.db&neSKUdata=0]
[replacefounditems]value=[math][value]+1[/math][/replacefounditems]
[/search]
[search db=products.db&neSKUdata=0]
[replacefounditems]price=[math][price]*1.1[/math][/replacefounditems]
[/search]
This behavior is very different from the simpler [replace] context, which replaces all found items with the same value.
You may specify an absolute or relative path to the database file, as in "/WebCatalog/GeneralStore/somebase.db" or "../somebase.db". You may also place "^" in front of the database path to indicate that the file can be found in a global root folder called "Globals" inside the WebCatalogEngine folder.
Contrast between [replacefounditems] and [replace] | |||||
---|---|---|---|---|---|
[search db=products.db&neSKUdata=0] [replacefounditems] price=[math][price]*1.1[/math] [/replacefoundItems] [/search] | [replace db=products.db&neSKUdata=0] price=10 [/replace] | ||||
SKU | price before | price after | SKU | price before | price after |
1 | 5 | 5.5 | 1 | 5 | 10 |
2 | 10 | 11 | 2 | 10 | 10 |
3 | 15 | 16.5 | 3 | 15 | 10 |
4 | 20 | 22 | 4 | 20 | 10 |
5 | 35 | 38.5 | 5 | 35 | 10 |
DOWNLOAD WEBDNA NOW!
A list of available libraries for WebDNA...
F.A.QA compilation of some user's questions...
AWS Raw WebDNA LAMP-Plus WebServerAmazon Web Services (AWS) README for Machine Image ID...
WebDNA ModulesA list of the currently available modules...
Download WebDNA ApplicationsWebDNA applications...
Technical Change HistoryThis Technical Change History provides a reverse chronological list of WebDNA changes...
will display a random number...
[referrer]Displays the URL of the referring page...
[listdatabases]Lists all the currently-open databases...
[include]Include the contents of the specified file...
[sendmail]There is hardly a website that doesn't at some point need to send an email...
[convertwords]Changes specified words in a string of text to different words...