Re: TZF - possible topaz bug maintaining an mdx tag with a for condition

Marie Vihonsky <[email protected]> Mon, 20 Oct 2003 10:56:50 -0400
Newsgroups gmane.comp.lang.delphi.topaz
Message-ID <[email protected]>
Hi Tom,

First, I would never create an index tag based on a for condition - I 
don't think tags are meant for this.  What I would do is create an 
additional field which is a logical whose value would be dependent upon 
the 'for condition' and then update this field using the 'BeforePost' 
event.  Alternately, the field could be a 'calculated' field.

 > fields:
 >            id,            C,   2, 0
 >            name,     C, 12, 0
 >            income, N,   4, 0
              over999,  Logical

BeforePost Event
    if income > 999 then
       over999 := true
    else
       over999 := false;

Your tags would then be:
 >            tag2....      testFor       over999

Marie

Thomas LaFortune wrote:
> I believe that I have found a bug in Topaz.  Specifically, that Topaz 
> does not properly maintain an mdx tag with a for condition.  Creating 
> such an index works fine.  Appending new records works fine.  If an 
> existing record that satisfies the for condition (and hence is in the 
> tag) is edited so that it no longer satisfies the for condition, then it 
> is properly removed from the tag.  However, if an existing record that 
> does not satisfy the for condition (and therefore is not in the tag) is 
> edited so that it satisfies the for condition, it is NOT added to the tag. 
>  
> I am working with Delphi 5.1 and have updated Topaz to the latest patch.
>  
> Does anyone use a mdx with a for condition?  If so, have you noticed 
> this problem?
>  
> The following five minute exercise demonstrates the problem. 
> Start new application. 
> Put a TtzDbf on the form.
> Name the component TZ and the dbfFileName fred.dbf.
> Go to the dbfFields property, open the editor add the following three 
> fields:
>            id,            C,   2, 0
>            name,     C, 12, 0
>            income, N,   4, 0
> Then close editor.
> Set active to true.
> Go to the "Index List" property, open editor and create two tags:
>                               Name           Key          For
>            tag1....      idOrder             id
>            tag2....      testFor       name          income>999
> Leave the descending and unique boxes blank.
> Close the editor (by selecting done).
> Add a dataSource and set the dataSet property as TZ.
> Add a TdbGrid and set it's dataSource property.
> Add two buttons.
> Change the caption of one button to "idOrder" and make it's click procedure:
>             tz.setOrderToTag( 'idOrder');
> Change the caption of the other button to "testFor" and make it's click 
> procedure:
>             tz.setOrderToTag( 'testFor');
> Save the files to some scrap folder and run program.
>  
> Add six records:          id                name                income
>  
>                                         a                
> able                    50
>                                         b                
> bob                     5000
>                                         c                 
> cat                       75
>                                         d                
> dog                      7500
>                                         
> e                edit                       12
>                                          
> f                 frank                    1200
>  
> Press the testFor button.  Only Bob, dog and frank are there.  This is 
> correct and shows append works.
>  
> Now press the idOrder button.
> Change bob to 5 (from 5000) and cat to 1750 (from 75).
> Press the testFor button.
> Bob is no longer there --- correct.   But, where is cat?
> Close program.
>  
> Change the CreateIndex property of the Topaz component to ciAlways.
> Run program.
> Press testFor button.
> There's cat!  (showing that index creation works).
>  
>       Tom LaFortune
> 
> --^^---------------------------------------------------------------
> This email was sent to: [email protected]
> 
> EASY UNSUBSCRIBE click here: http://topica.com/u/?clvXPN.a2kMRq.bXZpaG9u
> Or send an email to: [email protected]
> 
> TOPICA - Start your own email discussion group. FREE!
> http://www.topica.com/partner/tag02/create/index2.html
> --^^---------------------------------------------------------------
> 

--^----------------------------------------------------------------
This email was sent to: [email protected]

EASY UNSUBSCRIBE click here: http://topica.com/u/?clvXPN.a5kvff.Z2NsZHQt
Or send an email to: [email protected]

TOPICA - Start your own email discussion group. FREE!
http://www.topica.com/partner/tag02/create/index2.html
--^----------------------------------------------------------------