Technical References - [addfields]

[addfields db=...]...WebDNA...[/addfields]

numero = 195
interpreted = N
texte = The [addfields] context adds new fields to an existing WebDNA database. First, lets use the following code to create a new test database and run a simple search on the new database.
[closedatabase db=addfields_test.db][writefile file=addfields_test.db]IDNAME1      Scott2      Rusty3      David4      Daniel5      Dustin[/writefile][search db=addfields_test.db&neIDdata=[blank]&rank=off][founditems][ID] - [NAME][/founditems][/search]
Results: 1 - Scott 2 - Rusty 3 - David 4 - Daniel 5 - Dustin Now, lets use the [addfields] context to add EMAIL and PHONE fields to the 'addfields_test.db' database, initializing the new field value with some arbitrary data. We will again perform a simple search on the same database to confirm that the new fields, and field data, have been added. We use the following WebDNA code:
[addfields db=addfields_test.db]EMAIL=us@com&PHONE=12-1235[/addfields][search db=addfields_test.db&neIDdata=[blank]&rank=off][founditems][ID] - [NAME] - [EMAIL] - [PHONE][/founditems][/search]
Results: 1 - Scott - us@com - 12-1235 2 - Rusty - us@com - 12-1235 3 - David - us@com - 12-1235 4 - Daniel - us@com - 12-1235 5 - Dustin - us@com - 12-1235

the [addfields] context will not add fieldnames that already exist in the target database.

[addfields] will not add more than 4 fields at one time; in the following example, the "fifth" field will not be added

[addfields db=test.db]address=[blank]&website=[blank]&brochure=[blank]&Home=[blank]&fifth=[blank][/addfields]

[deletefields] feature has been added in version 8.6 [deletefields db=test.db&fieldnames=column1,column4]

The [addfields] context adds new fields to an existing WebDNA database.

First, lets use the following code to create a new test database and run a simple search on the new database.

[closedatabase db=addfields_test.db]

[writefile file=addfields_test.db]IDNAME
1 Scott
2 Rusty
3 David
4 Daniel
5 Dustin

[/writefile]

[search db=addfields_test.db&neIDdata=[blank]&rank=off]
[founditems]
[ID] - [NAME]
[/founditems]
[/search]

Results:
1 - Scott
2 - Rusty
3 - David
4 - Daniel
5 - Dustin

Now, lets use the [addfields] context to add EMAIL and PHONE fields to the 'addfields_test.db' database, initializing the new field value with some arbitrary data. We will again perform a simple search on the same database to confirm that the new fields, and field data, have been added.

We use the following WebDNA code:

[addfields db=addfields_test.db]EMAIL=us@com&PHONE=12-1235[/addfields]

[search db=addfields_test.db&neIDdata=[blank]&rank=off]
[founditems]
[ID] - [NAME] - [EMAIL] - [PHONE]
[/founditems]
[/search]

Results:

1 - Scott - us@com - 12-1235
2 - Rusty - us@com - 12-1235
3 - David - us@com - 12-1235
4 - Daniel - us@com - 12-1235
5 - Dustin - us@com - 12-1235

the [addfields] context will not add fieldnames that already exist in the target database.


[addfields] will not add more than 4 fields at one time; in the following example, the "fifth" field will not be added



[addfields db=test.db]address=[blank]&website=[blank]&brochure=[blank]&Home=[blank]&fifth=[blank][/addfields]


[deletefields] feature has been added in version 8.6
[deletefields db=test.db&fieldnames=column1,column4]




DOWNLOAD WEBDNA NOW!

Top Articles:

Tips and Tricks

A list of user-submitted tips ...

WebDNA Modules

A list of the currently available modules...

F.A.Q

A compilation of some user's questions...

WebDNA reference

...

WebDNA Libraries

A list of available libraries for WebDNA...

Technical Change History

This Technical Change History provides a reverse chronological list of WebDNA changes...

Related Readings:

[append]

[append db=base...

[thisurl]

[thisurl] displays the URL of the current page...

[listpath]

Breaks a path into separate foldernames and a filename...

[text]

Text variables are fundamental building blocks of the WebDNA language...

[showif]

[showif Comparison]Show This HTML[/showif]...

[calcfilecrc32]

calculates the CRC32 value of a given file...