Source language: Translate to:

Oddity with variable names

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Oddity with variable names

Postby kpmcginley » Sun Aug 31, 2008 12:57 pm

According to the Neobook DBPro Help file regarding the names of DBPro variables
Each variable is a combination of the Database ID (MyDB), a period (.), the Table Name (Clients), a period (.) and the field name.

However, I have an Access DB named "checkin" and three tables, one of which is title "DD". When I look in the debugger at the variables, it shows the variables from this table as DD.(fieldname) rather than prefaces these variables with "checkin". Further, when I change the variable names referring to the active record to simply "DD.(fieldname)", the variable updates properly. Otherwise, it does not. Does that make sense? Why does NB not refer to the variable in the debugger by its full name?
kpmcginley
 
Posts: 19
Joined: Mon Apr 07, 2008 1:43 pm

Postby Neosoft Support » Tue Sep 02, 2008 11:46 am

I'm not seeing that problem here, so it may have something to do with how you're opening your database. If you open and run the sample Address Book publication you should see the variable names displayed correctly in the debugger. For example:

Code: Select all
AddrBook.Contacts.FirstName=Robert
AddrBook.Contacts.LastName=Smith


In your publication take a look at the code you're using to open your database and tables. Make sure that the database ID property isn't blank. It should look something like this:

Code: Select all
dbpOpenAccessDatabase "AddrBook" "[PubDir]AddressBook.mdb" ""
dbpOpenTable "AddrBook" "Contacts" "DataBaseUpdate"
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

DB opened properly, I think

Postby kpmcginley » Fri Sep 05, 2008 4:45 pm

This is the code that I am using to create the MDB and then to open it. If the DB is alreayd recreated, the code looks for the file and, if found, simply opens up the MDB and the table and then open the table:
Code: Select all
FileExists "[pubdir]checkin.mdb" "[fe]"
If "[fe]" "=" "false"
dbpCreateAccessDatabase "[pubdir]checkin.mdb" "Password=;Encrypted=No"
dbpOpenAccessDatabase "checkin" "[pubdir]checkin.mdb" ""
dbpCreateTable "checkin" "MHcheckin" "nameFA String(50);mis String(10);clinician String(49);cidate String(15);dateidx BigInt;citime String(15);mhCD String(2);mhgroup String(50)"
dbpOpenTable "checkin" "MHcheckin" ""
Else
dbpOpenAccessDatabase "checkin" "[pubdir]checkin.mdb" ""
dbpOpenTable "checkin" "MHcheckin" ""
dbpTableExists "checkin" "DD" "[tabex]"
               If "[tabex]" "=" "False"
               dbpCreateTable "checkin" "DD" "nameFA String(50) PrimaryKey;MIS String(10);clinician String(49);DD1 Date;DD2 Date;DD3 Date;DD4 Date;DD5 Date;DD6 Date"
               dbpOpenTable "checkin" "DD" ""
               .StickyNote "-1" "-1" "Table DD created in checkin|Table DD opened." "2000"
               Else
               dbpOpenTable "checkin" "DD" ""
               .StickyNote "-1" "-1" "Table DD of checkin opened." "2000"
               Endif
Endif
Return
kpmcginley
 
Posts: 19
Joined: Mon Apr 07, 2008 1:43 pm

Postby Gaev » Fri Sep 05, 2008 5:45 pm

kpmcginley:

I attached your code to a button in a pub ... and ran it ... no problems at all ... even added content in the first record ...
Code: Select all
...
dbpOpenTable "checkin" "DD" ""
        StickyNote "-1" "-1" "Table DD of checkin opened." "2000"
        If "[checkin.DD.nameFA]" "=" ""
            SetVar "[checkin.DD.nameFA]" "primary_abcdef"
            SetVar "[checkin.DD.clinician]" "abcdef"
        EndIf
... so fields would show up in the debug window.

Suggestions ...

a) download my AccessDBU utility from ... http://www.scriptedlogic.com/AccessDBU.htm ... and view the contents of your DD table ... see if everything looks ok ... in particular that records do not have empty content for column/field nameFA ... primary keys can not be empty.

b) make sure you have
Code: Select all
dbpShowErrors "Yes"
.. so you can be alerted of any errors being reported.

c) rename "checkin.mdb" ... and rerun the pub ... so you can create a brand new database ... in case the current one is somehow corrupted.


Question: how do you go about adding/updating records in the DD Table ? ... via a Grid or do you have some SetVar commands ... if latter, might post them here.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Problem found and fixed

Postby kpmcginley » Sun Oct 12, 2008 11:40 am

Like most things, the problem was simple and based upon unfamiliarity with the program. I had not set the program to AutoSave Edits and had not issued the command "dbpSaveEdits'. Once I did this, of course, it save the new data fine.

:oops:

Thanks, Gae & Support v, for your help.
kpmcginley
 
Posts: 19
Joined: Mon Apr 07, 2008 1:43 pm


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 1 guest

cron