Page 1 of 2

dbpro questions

PostPosted: Thu Jul 24, 2014 7:02 am
by yanzco
hello.
i have a few questions / needing help to with dbpro...

1. how do i find which recordnumber am i selecting in the grid in display all grid (dbpshowall)
the grid is set to single line selection...

2.
database:
ID, name, age
1, aaaa, 20
2, bbbb, 21
3, cccc, 22

if the "2line" is selected, how do i display or place in a variable the "name"

i've been trying to do it with "dbpecordtovar" command , it stores the whole 1|bbbb|21 to a var..
how do i get the bbbb out of the string?


3. if i know what record number i need to display..
ex: record 44of99

how do i display the record 44?
dbpgotorecord ? what do i do next?

Re: dbpro questions

PostPosted: Thu Jul 24, 2014 8:13 am
by Gaev
yanzco:

From Help file >>> Creating Database Enabled Publications >>> Special Variables ...
Below is a list of status variables created for automatically by NeoBookDBPro. Replace "ID" with your Database ID and "Table" with the name of your table.

[ID.Table.$RecNum]
This is the current active record's position from the beginning of the file based on the current sort/query.

[ID.Table.$RecCount]
If a query is active, the result reflects the number of found records. When no query is active, the result reflects the total number of records in the database.

[ID.Table.$State]
This is the current state of the table. Possible values include "Browse", "Edit", etc.

[ID.$Status]
Contains the connection status of the database. This can be either "Connected" or "Not Connected".

... and from Help file >>> Creating Database Enabled Publications >>> Working With Data ...
The Clients table contains the following fields:

FirstName
LastName
Street
City
State
Zip
Telephone

After opening the table, NeoBookDBPro would automatically create the following NeoBook variables:

[MyDB.Clients.FirstName]
[MyDB.Clients.LastName]
[MyDB.Clients.Street]
[MyDB.Clients.City]
[MyDB.Clients.State]
[MyDB.Clients.Zip]
[MyDB.Clients.Telephone]

Each variable is a combination of the Database ID (MyDB), a period (.), the Table Name (Clients), a period (.) and the field name. Since NeoBookDBPro allows you to open multiple databases and tables at the same time, this method makes it unlikely that any two databases will have conflicting field names.

Re: dbpro questions

PostPosted: Thu Jul 24, 2014 8:31 am
by yanzco
oh!, didnt know it was that simple..

i have another question


in the dbpro samples..

orderentry sample

while viewing the invoice records.. it shows the order list of the current invoice..
how did it display different fields of the order details table...?

Re: dbpro questions

PostPosted: Thu Jul 24, 2014 11:34 am
by Neosoft Support
in the dbpro samples..orderentry sample

while viewing the invoice records.. it shows the order list of the current invoice..
how did it display different fields of the order details table...?


We used DBPro's dbpDefineRelationship action to link the OrderNum field in both the Invoices and OrderDetails tables. When the Invoice tables changes the matching records in OrderDetails are automatically displayed. You can see the code for this in the Order Entry sample's StartUp action.

Re: dbpro questions

PostPosted: Sat Jul 26, 2014 6:38 am
by yanzco
got it.. :D thanks!

another question..
is it possible for dbpro
to query search like this..

[_______] search bar
as i type a letter.. it searches and gives result in a container as i type a letter..
then when i click on the resultit stores it in a variable

[d______] search bar
dalton
daryl
daisy
...
...

[dav____] search bar
dave
davon
david
...
...

left click on [david]

x = david

Re: dbpro questions

PostPosted: Sat Jul 26, 2014 7:18 am
by Gaev
yanzco:

It is theoretically possible ... however, depending on the speed of the computer and the size/location of the database, it may not be fast enough to do all the necessary work between keystrokes ... especially when the user just enters one or two letters in the Search Box.

The general design would be to use a Text Entry Tool as the Search Box ... and in its TextChange event section ...

- if the Search Box is not empty, do a dbpQuery command ... for the filter use something like FirstName LIKE "[TextEntry1]%" ... which will return all records where field called FirstName begins with the contents of the tool called TextEntry1

- then use dbpFieldToVar to copy the contents of the desired field (from all matching records) to a variable ... if this variable is specified as the one to contain the List Items in a ListBox/ComboBox Tool, it will display the matching items in that tool

Re: dbpro questions

PostPosted: Sat Jul 26, 2014 7:54 pm
by yanzco
i see, i would try that tonight.. thanks gaev. :D

Re: dbpro questions

PostPosted: Sun Jul 27, 2014 8:47 am
by yanzco
the search bar works now..
with every letter typed, it searches the closest it matches..

now, ive got alist maker like in one of the DBpro sample [OrderEntry]

it lists the items ordered of the invoice in OrderDetails in grid view...
when double clicked, it deletes an item..

i tried mine, when i add a student. it adds to the database...
works ok.
but when i try to double click to delete the selected student..
dbpDeleteRecord

it clears the grid.
(blank view on the grid)

when i check access database, all the other students are there, and the deleted record was successfully deleted.
but in [OrderEntry] sample, when you double click, it deletes, but doesnt clear the grid, the other items remain.

mine wont, it deletes the record, and clears the grid..

where did i go wrong? confused.

edit: temporarily, i query searched the definedrelationship linked field which is [class]
after dbpDeleteRecord, i added query search [class]
so it lists the results again at the table grid..

it now works as i want.. but, still i dont know why my grid clears when i delete a record earlier..

Re: dbpro questions

PostPosted: Mon Jul 28, 2014 10:47 am
by Neosoft Support
...still i dont know why my grid clears when i delete a record earlier.


I think you can solve this by clearing the active query with dbpShowAll. For example:

dbpDeleteRecord...
dbpShowAll...

Re: dbpro questions

PostPosted: Mon Jul 28, 2014 11:16 am
by yanzco
i tried it just now, but it only shows all the records after i deleted a record..
even the other records that are not related (not same class)
i wanted it to show the same query results as i deleted a record

Re: dbpro questions

PostPosted: Tue Jul 29, 2014 10:09 am
by Neosoft Support
That should work. Can you supply us with a small sample publication that we can use to reproduce the problem?

Re:

PostPosted: Fri Aug 08, 2014 7:32 am
by zina
Hello,

Is there a "SAFE" command in dbpro? so that a user can manualy safe the new input that was made

thanks

Re: dbpro questions

PostPosted: Fri Aug 08, 2014 9:23 am
by Gaev
zina:

so that a user can manualy safe the new input that was made
If you are asking how one would "add a record to the database" using "field values in NeoBook variables", the way to do this is to ...

- add a new empty record to a table
- then use NeoBook's syntax for accessing each field like so ...

Code: Select all
dbpOpenAccessDatabase "MyDB" "c:\my files\AddressBook.mdb" ""
dbpAddRecord "AddrBook" "Contacts"

SetVar "[MyDB.Contacts.FirstName]" "[your_Input_Field_For_FirstName]"
SetVar "[MyDB.Contacts.LastName] "[your_Input_Field_For_LastName]"
etc. etc.

... optional
dbpSaveEdits "AddrBook" "Contacts"

For more information, see the Help file ... Creating Database Enabled Publications >>> Working With Data

Re: dbpro questions

PostPosted: Fri Aug 08, 2014 10:36 am
by zina
Hello

Thank you Gaev,
That was the command I was looking for

Is there somewere a list arround with all these commands?

grtz
zINA

Re: dbpro questions

PostPosted: Fri Aug 08, 2014 12:24 pm
by Gaev
Zina:

Is there somewere a list arround with all these commands?

On the first page of the Help file, click on the link labelled Action Command Reference ... the resulting page has all the commands nicely grouped by Category.

In fact, it is a great idea to read all sub-sections of the section labelled Creating Database Enabled Publications to get a full understanding of all that the plugin offers.