Source language: Translate to:

RecNum ReCount

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

RecNum ReCount

Postby BRobinsonS » Tue Jan 28, 2014 8:23 pm

I have an app which opens different databases using FileOpen and get DatabaseName and TableName.
I have a text field I want to display the current recnum (using $Recnum) and total records (using $RecCount).
I working in another app but I am using the actual name of the database and table name i.e. Database.Table.$Recnum etc.

I have a subroutine:
Code: Select all
:UpdateRecordCount
SetVar "RecCountStr" "[[DatabaseName].[TableName].$RecCount]"
SetVar "RecNumStr" "[[DatabaseName].[TableName].$RecNum]"
Return

which is only called once when opening the table. And get the right number except $Recnum = 1 and since it is only called once the Recnum doesn't change.

Using "[[DatabaseName].[TableName].$RecCount] and "[[DatabaseName].[TableName].$RecNum] in a text field is blank.
I want to show the changing RecNum as I scroll through the records in the table.
Like I say, if I use the direct Database name and Table name it works (in another app).

This is the code I use to get the Database name and Table names displayed in Listbox.
Code: Select all
.clear Table list
ListBoxDeleteItem "TableListBox" "All"
.open db and list tables
FileOpenBox "Select a Database" "Database Files|*.mdb" "[LastDir]" "[FileName]" ""
ExtractFileName "[FileName]" "[DatabaseName]"
ExtractFilePath "[FileName]" "[NewDir]"
SetVar "[CurrentDir]" "[NewDir]"
dbpOpenAccessDatabase "[Databasename]" "[NewDir][DatabaseName]" ""
.show tables
dbpGetTableNames "[DatabaseName]" ";" "[TableList]"
StrParse "[TableList]" ";" "[TableList]" "[TableCount]"
Loop "1" "[TableCount]" "[LoopCounter]"
 ListBoxAddItem "TableListBox" "0" "[TableList[LoopCounter]]"
EndLoop


Ideas ?
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 340
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Re: RecNum ReCount

Postby mishem » Wed Jan 29, 2014 1:42 am

mishem
 
Posts: 575
Joined: Mon Oct 08, 2012 1:51 pm

Re: RecNum ReCount

Postby Gaev » Wed Jan 29, 2014 7:05 am

Brian:
which is only called once when opening the table. And get the right number except $Recnum = 1 and since it is only called once the Recnum doesn't change.
How is this subroutine called ? ... explicitly via a GoSub command ? ... or from the dbpOpenTable command ?

From the Help info for the command ...
dbpOpenTable "database id" "table" "subroutine"

subroutine

The name of a subroutine from your publication's Subroutine Action. The subroutine specified here will be automatically executed whenever the table is updated or the current record number changes. This can be useful if you want to activity to take place whenever the reader displays a different record. Subroutines are entered from the Actions page of NeoBook's Book Properties screen.

If you specify UpdateRecordCount as the subroutine to be called, it will refresh the values for [RecCountStr] and [RecNumStr] ... if you specify these (non-nested) variables in the Simple Text object (box), they will be refreshed with every change of the (current) record position.
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: RecNum ReCount

Postby BRobinsonS » Wed Jan 29, 2014 4:59 pm

Thanks Gaev,
Wow it works !
Now I understand how the 'subroutine' on open table is useful.

P.S. my [[DatabaseName].[TableName].$RecNum] works as expected.
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 340
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 1 guest