 |
Daedalus_13 Newbie
Joined: 26 Jun 2007 Posts: 6
|
Posted: Thu Jun 28, 2007 11:17 pm
How do a get a specify row/column value from CMUD DB? |
I have a CMUD Database with 3 columns, Lets call them COL1, COL2, and COL3.
I am trying to access a particular row and column value, and assign that to a variable.
So, what I want to do is something like:
#VAR databasevalue = (row 4, col 2)
where row is @key (db key 0 = row 0) and col is COL1, COL2, etc.
But for the life of me I cant figure this out.
I have played with this stuff a bunch, but cant seem to figure out how to get it to work, and it's driving me crazy. It seems like there should be a simple getkey function, but there isnt. I can get the whole row back, in %rec, but then I cant seem to get any particular "column" of data out of that.
I would also like to put information back into the database, but I think I can do this with:
#addkey @key(which is just the row #) COL2 VALUE(to be stored)
Is that correct?
Any help would be appreciated. Thanks! |
|
|
 |
Daedalus_13 Newbie
Joined: 26 Jun 2007 Posts: 6
|
Posted: Thu Jun 28, 2007 11:23 pm |
Amazing. Murphy's law at it's best.
Right after this, I looked at the help file one last time, and within 1 minute (after spending 2 hours on this), I found my answer:
#var TARGETVAR %db(<ROW>,"<COLNAME>")
Hmm...But, I cant get ADDKEY to work.
I have tried both
#addkey 4 {COL2=<DATA>}
#addkey 4 COL2 <DATA>
to edit the 4th record, but neither work.
Perhaps this should be #DBPUT, but that doesnt seem to work at all - it pops open the database window and then I can't close it.
I am using CMUD 1.34.
Any ideas? |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Jun 29, 2007 12:40 am |
Your explanation "#VAR databasevalue = (row 4, col 2) where row is @key (db key 0 = row 0) and col is COL1, COL2, etc." didn't help me much, mostly because you're mixing code with explanation. Try to be clearer about what you mean.
My first question is whether you're using database record variables or CMUD's database module. You seem to mention both a couple of times in your post. I think you mean the latter, though - in that case, you shouldn't be using #addkey - check out the #new command. Also see the database scripting reference topic. |
|
|
 |
Daedalus_13 Newbie
Joined: 26 Jun 2007 Posts: 6
|
Posted: Fri Jun 29, 2007 12:48 am |
i answered my first question about GETTING the data, so you can disregard the #VAR stuff, - but now I can't update it...
I am using CMUD's database module...
Thanks for the db scripting reference...It SEEMS like using #DBPUT 20 {Name=Zugg|Class=Warrior} would work...but all that does is pop up the database window, and nothing can be done about it...I can't close it; I need to shut down Cmud to clear it. When I reopen it, the database record has not been updated.
Is there another way to do it?
Thanks again! |
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|