API methods on binary link

Olivier vidal_olivier at yahoo.fr
Sat Jan 22 19:37:24 CST 2005


Hi Ruslan and list,

I have the impression that it is not easy to use the API when we want 
to obtain sorts of temporary tables (consisted of fields of several 
linked tables).
It is maybe because I still thinks in term of SQL.

For example, always with my tables of zip / city and streets.

I have a datagrid which has to display in the opening of the window a 
list with three columns.
First column: zip (table ZipCity)
The second column: city (table ZipCity)
The third column: street (table Streets)

It has to display all the streets with the zip beginning with 75.
The list must be sorted out by zip, city, street.

Ex:
75001 	 PARIS 	 street of Kiev
75001 	 PARIS 	 street Clemenceau
75001 	 PARIS 	 place Vendôme
75002 	 PARIS 	 impasse of Bordeaux

The first one and the second column are thus two fields of the table 
"zip/city"
The third column is a field of the table "streets".

In SQL:

SELECT zip, city, street FROM ZipCityTb, StreetTb WHERE left (zip, 2) = 
'75' ORDER by zip, city, street

We obtain then a cursor with which I can easily fill my datagrid.
Especially, the cursor keeps a number for all the line " zip, city, 
street ", even if originally they are two different tables.
It is very practical to modify couples " zipCity-Streets " for example, 
because the couple is kept in 1 line of the cursor.

But with the sets it is less evident because 1 set is attached to 1 
single table.

The sets are perfected to work on a table but on any?
In my example, I do not manage to obtain a practical code.

please, How would you make to make an equivalent of this SQL query?

thank you very much

olivier



Le 22 janv. 05, à 14:13, Ruslan Zasukhin a écrit :

> On 1/22/05 2:03 PM, "Olivier" <vidal_olivier at yahoo.fr> wrote:
>
>> Hi Ruslan and list,
>>
>>> I have a table of ZIP-Citys :
>>>
>>>   zip=new vstring("zip",5,EVflag.fIndexed)
>>>   city=new vvarChar("city",100,EVflag.fIndexed+EVflag.findexByWords)
>>>   CityIdx=new vvarChar("cityIdx",100,EVflag.fIndexed,"city")
>>>
>>> and a table of streets :
>>>
>>>   street=new
>>> vvarChar("street",100,EVflag.fIndexed+EVflag.fIndexByWords)
>>>   streetIdx=new vvarChar("streetIdx",25,EVflag.findexed,"street")
>>>
>>> Every street belongs to a couple zip / city :
>>>
>>> link_Street_ZipCity=new vbinaryLink("link_Street_ZipCity", ZipCityTb,
>>> StreetTb, EVlinkType.kOne, EVlinkType.kMany)
>>>
>>>
>>
>> If I want to see all the streets the zip of which begins with '33', in
>> SQL I makes:
>>
>> SELECT * FROM ZIPCity, Streets WHERE left(zip,2)='33'
>
> You make at first search in table ZIP
>
>     set1 = fldZip.Find( 33 )
>
> Now you can iterate set and use
>
>     Link.FindLinked(
>         inRecID as Integer, inTableA as VTable, inTableB as VTable
>
>
> Hmm, we need enable into V4RB one more function that do
>
>     set = Link.FindLinked( inSet, TA, TB )
>
> We have such func in kernel.
>
>
> -- 
> 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
> -------------------------------------------------------------
>
>
> _______________________________________________
> Valentina-beta mailing list
> Valentina-beta at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina-beta
>



More information about the Valentina-beta mailing list