Related Record Count Syntax Please

Ruslan Zasukhin sunshine at public.kherson.ua
Sat Dec 18 23:21:41 CST 2004


On 12/18/04 11:15 PM, "Chuck Pelto" <cbpelto at pcisys.net> wrote:

Hi Chuck,

RIGHT NOW I am finishing docs on new functions of Valentina 2.0 :-)

In 2.0 we have VERY EFFECTIVE, SIMPLE and NICE solution for your task,
chuck.

We introduce new functions that you can use in SQL or in methods.
This is part of docs:

---------------------
COUNT_LINKED( TABLE_NAME, LINK_NAME, [DIRECTION = ToChild] )

Returns the count of records linked to a record of the table TABLE_NAME by
link with name LINK_NAME. It never returns NULL.
---------------------

So I will recommend to switch step by step to Valentina 2.0.
V4RB 2.0 beta is quite stable now.

It is time to start guys! :-)


> Hi Peter,
> 
> Is there any way to do this WITHOUT going to an SQL search?
> 
> There IS the call for RecordCount in the reference manual. Is there a
> way to use BaseObject pointers and achieve this?
> 
> Regards,
> 
> Chuck
> 
> 
> On Dec 18, 2004, at 2:10 PM, Peter De Berdt wrote:
> 
>> 
>> On 18 Dec 2004, at 21:48, Chuck Pelto wrote:
>> 
>>> What is the sequence of calls and the syntax thereof for getting the
>>> number of related records found in a child data file?
>>> 
>>> I see RecordCount but in every example used in the reference, it only
>>> describes the data in the BaseObject. Not any related BaseOjbect.
>>> 
>> As soon as you query the related BaseObject, the database will return
>> the "related records"
>> 
>> Example
>> 
>> SELECT * FROM MasterTable, RelatedTable WHERE ...
>> 
>> Will return the related records, together with all the fields from the
>> master table (which will be the same in all the records)
>> 
>> Alternatively, you could use
>> 
>> SELECT Count(*) FROM MasterTable, RelatedTable WHERE ...
>> 
>> Then you can take the ULongValue from the first field and you'll have
>> the number of records.
>> 
>> Ruslan will be able to tell you which one of the two is the most
>> performant (in a multi-user environment, you'd better use a server
>> side cursor in the first option).

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------




More information about the Valentina mailing list