Base Object Method Prevents Adding Records

Thomas totoole at rocko.lab.csuchico.edu
Sat Oct 23 09:58:58 CDT 2004


>> Hi all,
>>
>> The following Base Object Method is causing trouble in VAPP.
>>
>> if(ptr_parent_rcd = ptr_child_rcd,'False',if(ptr_parent_rcd  
>> ptr_child_rcd,concat(ptr_parent_rcd,'- 
>> ',ptr_child_rcd),concat(ptr_child_rcd,'-',ptr_parent_rcd)))
>>
>> It applies to a table with the following fields:
>> ptr_parent_rcd        (an ObjectPtr to one side of a many to many  
>> join)
>> ptr_child_rcd        (an ObjectPtr to the other side of the many to  
>> many join)
>>
>> This is a recursive many to many so the target of both ObjectPtrs is  
>> the same, but they point to different RecIDs in the target table.
>
> The first point.
>
> I see that you compare values of ObjectPtrs,
> I.e. Values of RecID they point to.
>
> This is mistake.
>
> Because if you will delete a record, then its RecID is reused.

The "On delete" property for both the parent and child ObjectPtrs in  
the lookup table is set to "Cascade". So the ObjectPtrs are deleted  
when the RecIDs they point to are deleted, no? Does this not prevent  
re-use mistakes? Is there a better way to manage these comparisons?

>> The Base Object Method's Unique property is set to true.
>
> As I have think.
>
> Then you have 2 records with the same value.
> Check this.

I checked this by setting the Base Object Method's Unique property to  
false, then importing the records, then setting the Unique property  
back to true. If there were duplicate records, wouldn't VAPP prevent  
the Unique property from being set back to true?

Thanks for your help.

> The purpose of the Base Object Method is to prevent duplicate records  
> from being added to the table. If there is a record relating parent  
> RecID 10 to child RecID 11, I need to prevent another record relating  
> RecID 10 to RecID 11 from being created, regardless of which RecID is  
> in the parent column and which is in the child column.
>
> So if we have a record:
> ptr_parent_rcd    ptr_child_rcd
> 10                11
>
> We need to prevent the following record:
> ptr_parent_rcd    ptr_child_rcd
> 11                10
>
>  Furthermore, records where parent and child pointers are equal need  
> to be prevented. So I create one unused record where this is the case,  
> and the Base Object's Unique property prevents any others.
>
> The problem is, the Base Object Method will not allow valid records to  
> be added using the import method or the VAPP interface. No error is  
> returned. The import method runs, but the records are not
> added. The Base Object Method does not stop the  
> make-new-record-with-datamethod from adding valid records.
>
> Any ideas much appreciated.



More information about the Valentina mailing list