|
Belmyrddyn Magician
Joined: 17 Oct 2001 Posts: 371 Location: USA
|
Posted: Sat Aug 17, 2002 4:51 am
Database Variables |
How do I change the value of a database variable?
For example:
#LOOPBD @A {#IF (%key = "Value1") {#VAR %val "Value2"}}
Of course that doesn't work, but how do I would I change that value, besides going into the variable and manually editing it?
Belmyrddyn |
|
|
|
Drevarr Beginner
Joined: 19 Dec 2001 Posts: 17 Location: USA
|
Posted: Sat Aug 17, 2002 5:42 am |
Try %query and #DBPUT
I use this to update records that match by name and weight, if it doesn't match I create a new record.
#ALIAS SetID_DB {#VAR dbCompare %query(((&Name=@objectname)&(&WT=@ObjectWT)),All);#IF (!%null( @dbCompare)) {#DBPUT @dbCompare {Name=@objectname|WT=@Object_WT};#SAY Item Stats Updated} {#NEW All @newrecord;#SAY New Item Added to Database};#dbreset;#DBSAVE;ClearID;IDdb_OFF} |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Aug 17, 2002 8:57 am |
You can't change the value of system variables, such as %val, directly. The reason they are called "system" variables is that the system controls their value.
To change the value of an existing key in a database variable use #ADDKEY.
#LOOPDB @A {#IF (%key = "Value1") {#ADDKEY A {Value1} {Value2}}
LightBulb
Senior Member |
|
|
|
|
|