Source language: Translate to:

Small problem

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Small problem

Postby Alex » Sun Nov 19, 2006 7:48 am

Hi,

I have a question with the dbf action.
Look, if I want to have, in my Text.dbf, 2 part, the first is Name1 and the seconde is Name2, and when I write in the TextEntry1 : Alex
It writes in my Text.dbf in Name1 : Alex and in Name2 : Alex

My problem is, when I take this action, it's remplace the first information in my Tex.dbf. I had take this action : dbfVarToRecord "[PubDir]Text.dbf" "[TextEntry1]"

Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Gaev » Sun Nov 19, 2006 8:46 am

Alex:
Look, if I want to have, in my Text.dbf, 2 part, the first is Name1 and the seconde is Name2, and when I write in the TextEntry1 : Alex
It writes in my Text.dbf in Name1 : Alex and in Name2 : Alex
... take a look at the Variable (to store Text Entry contents) field ... both might be set to [TextEntry1] ... especially if you made (duplicated) TextEntry2 object from TextEntry1 object.
My problem is, when I take this action, it's remplace the first information in my Tex.dbf. I had take this action : dbfVarToRecord "[PubDir]Text.dbf" "[TextEntry1]"
... from the Help file ...
Code: Select all
dbfVarToRecord:

Paste the contents of a formatted variable to the current record. The variable must be formatted in comma delimited ASCII ...
... so try ...
Code: Select all
dbfVarToRecord "[PubDir]Text.dbf" "[TextEntry1],[TextEntry2]"
... but make sure neither of the variables contain a comma "," character ... otherwise everything will be messed up ... a safer thing would be to do ...
Code: Select all
SetVar "[Text.Name1]" "[TextEntry1]"
SetVar "[Text.Name2]" "[TextEntry2]"
User avatar
Gaev
 
Posts: 3733
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Alex » Sun Nov 19, 2006 9:44 am

Thanks

It is possible that the message is save in the end of the Text.dbf ?

And how many charactere can I write in a Text.Name1 ??

Because when I write It's stop it and I can't write anymore.

Thanks

Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Gaev » Sun Nov 19, 2006 10:19 am

Alex:
It is possible that the message is save in the end of the Text.dbf ?
... when you add a record to the database (dbfAddRecord), it is always added to the end of the database ... but you can view it in a different order using dbfSort
And how many charactere can I write in a Text.Name1 ??
Because when I write It's stop it and I can't write anymore.
... depends on the type of field you defined ... read the Help file ... under dbfCreate for details of each field type.
User avatar
Gaev
 
Posts: 3733
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Alex » Sun Nov 19, 2006 12:03 pm

Thanks but it's not working.

I did :

SetVar "[Text.Name1]" "[TextEntry1]"
SetVar "[Text.Name2]" "[TextEntry2]"
dbfVarToRecord "[PubDir]Text.dbf" "[TextEntry1],[TextEntry2]"
dbfSort "Text.dbf" "" "Name1|Name2" "Ascending"


Thanks

Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Gaev » Sun Nov 19, 2006 12:42 pm

Alex:
Thanks but it's not working.
... can you explain ... what exactly is not working ? ... i.e. what were you expecting ... and what are you experiencing ?
I did :

SetVar "[Text.Name1]" "[TextEntry1]"
SetVar "[Text.Name2]" "[TextEntry2]"
dbfVarToRecord "[PubDir]Text.dbf" "[TextEntry1],[TextEntry2]"
dbfSort "Text.dbf" "" "Name1|Name2" "Ascending"

a) You DON'T NEED BOTH the SetVar and the dbfVarToRecord commands ... try and remove the latter.

b) what is this code associated with ? ... the click section of a button ?

c) where do you do your dbfAddRecord command ?

d) where do you do your dbfCreate or dbfOpen commands ?

e) what did you expect the dbfSort command to do for you ?

f) have you read the Help file for NeoBookDB to understand how database files are managed via script commands ?

g) While you are unfamiliar with databases, it is a good idea to have a Rectangle object on your pub page and use the dbfShowTable command (see Help file for details) to see the full (Table) view of the database records ... so you can "learn by seeing what is happening" ... in response to each of your commands.
User avatar
Gaev
 
Posts: 3733
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Alex » Sun Nov 19, 2006 12:51 pm

When I write my name in the TextEntry1, I want my name go of the Text.dbf
Name1 and Name2.

It's not a new Text.dbf, also, when I click of the PuchButton1, this is the action :

SetVar "[Text.Name1]" "[TextEntry1]"
SetVar "[Text.Name2]" "[TextEntry2]"
dbfVarToRecord "[PubDir]Text.dbf" "[TextEntry1],[TextEntry2]"
dbfSort "Text.dbf" "" "Name1|Name2" "Ascending"

And it saves my name at the end of the file Text.dbf
Because, it saves in the first but I want the last.

Thanks

Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Gaev » Sun Nov 19, 2006 4:05 pm

Alex:
When I write my name in the TextEntry1, I want my name go of the Text.dbf
Name1 and Name2.
... LOL ... put this down to "lost in translation" ... from your first post in this topic, I thought IT was a problem (you wanted to avoid) ... not something you wanted to happen.
It's not a new Text.dbf
... so you are doing a dbfOpen command somewhere in your pub's StartUp section (or PageEnter section) ?
when I click of the PuchButton1, this is the action :

SetVar "[Text.Name1]" "[TextEntry1]"
SetVar "[Text.Name2]" "[TextEntry2]"
dbfVarToRecord "[PubDir]Text.dbf" "[TextEntry1],[TextEntry2]"
dbfSort "Text.dbf" "" "Name1|Name2" "Ascending"
... so what you need is ...
Code: Select all
SetVar "[Text.Name1]" "[TextEntry1]"
SetVar "[Text.Name2]" "[TextEntry1]"
... so both fields will have the same value (i.e. [TextEntry1])
And it saves my name at the end of the file Text.dbf
Because, it saves in the first but I want the last.
... where are you adding a new record (see dbfAddRecord command in the help file) ... if you do not, the current record's fields will be updated ... after you do a dbfOpen, the current record is the first record in the database ... so if you want to save the contents of [TextEntry1] in a new record (at the end of the database), you should insert the dbfAddrecord command BEFORE the two SetVar commands ... and you don't need to issue the dbfSort command each time ... so you might want to place the dbfSort command just after your dbfOpen command ... and note that the command requires four "parameters" of the form ...
Code: Select all
dbfSort "file name" "index file" "field" "direction"
... your example only has three parameters !!!
User avatar
Gaev
 
Posts: 3733
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Alex » Mon Nov 20, 2006 7:54 am

Thanks Gaev


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 2 guests