J,
 
As usual, there are several ways to do most anything in R:Base; here are two
additional commands to count records:
 
SELECT COUNT(*) INTO vCount FROM your_table_name
And
SET VAR vCount = SYS_NUM_ROWS IN SYS_TABLES WHERE SYS_TABLE_NAME =
'your_table_name'
 
The first command is slightly slower for large tables as it counts the
records. The second command simply reads the number of records from the
SYS_TABLES table.
 
Javier,
 
Javier Valencia, PE
913-829-0888 Office
913-915-3137 Cell
913-649-2904 Fax
 <mailto:[email protected]> [email protected]
 
  _____  

From: [email protected] [mailto:[email protected]] On Behalf Of J BLAUSTEIN
Sent: Tuesday, June 21, 2011 12:10 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: record count and delete sub record from a form
 
I send my last message before I read this one - this is what I was looking
for.  Thanks again
J
On 6/21/2011 12:01 PM, A. Razzak Memon wrote: 
At 11:42 AM 6/21/2011, J BLAUSTEIN wrote: 



I have two simple question? 
how do I get the record count for a table? 

J, 

There are two techniques to achieve this goal. 

01. Use Enhanced DB Navigator to be associated with appropriate table. 
    Make sure to enable the option for "Record Count". 

02. Use the GETPROPERTY TABLE 'tablename->RECORDCOUNT' varname command 

    -- Example 
    -- RecordCount_RecNo_Code.RMD 
    CLEAR VAR vRecordCount, vRecNo, vRecInfo 
    SET VAR vRecordCount TEXT = NULL 
    SET VAR vRecNo TEXT = NULL 
    SET VAR vRecInfo TEXT = NULL 
    GETPROPERTY TABLE 'Customer->RECORDCOUNT' vRecordCount 
    GETPROPERTY TABLE 'Customer->RECNO' vRecNo 
    SET VAR vRecInfo = ('  Record:'&.vRecNo&'of'&.vRecordCount) 
    PROPERTY RBASE_FORM CAPTION .vRecInfo 
    CLEAR VAR vRecordCount, vRecNo, vRecInfo 
    RETURN 



How do I make a form with a primary table - when I delete the primary 
table all the sub table records are delete? 

If I understand your question correctly ... 

The best and most eloquent method is to use the "CASCADE" option for 
the table with PRIMARY Key. 

Using R:BASE eXtreme 9.1, there are two available options while in 
Table Designer. 

Cascade: [ ] Update [ ] Delete 

Cascade - Maintains primary/foreign key relationships automatically. 
A CASCADE can be applied to UPDATE, DELETE, or BOTH data set changes 
for primary keys. For example, if you either UPDATE or DELETE a 
primary key value from a table, the corresponding foreign key values 
are updated or deleted automatically. CASCADE can only be added to 
tables with primary keys. 

. Update - enforces that when a primary key value is updated, the 
  corresponding value in the foreign key table(s) will also be updated. 

. Delete - enforces that when a primary key value is deleted, the 
   corresponding value in the foreign key table(s) will also be deleted. 

Separate UPDATE and DELETE data restrictions can allow a CASCADE to be 
enforced for values that are updated, but not enforced when records are 
deleted, in order to avoid an accidental or undesired record delete. 

Hope that helps! 

Very Best R:egards, 

Razzak. 



 
-- 


J. Blaustein
J Blaustein Associates, Inc.
        12 Herrick Drive
    Lawrence, NY 11559
516-371-3445 FAX 516-345-8009

Reply via email to