Valentina Digest, Vol 22, Issue 18

Thomas totoole at rocko.lab.csuchico.edu
Sun Oct 24 14:02:19 CDT 2004


Hi Ruslan,

>> Fact Table_______________________
>> Fct_Tbl_RecID        Fct_Tbl.Data_Field
>> 		10                Thomas
>> 		20                Mary
>> 		30                Jane
>> 		40                Lena
>> 		50                Lily
>>
>> Lookup Table_(2 Ptrs to 1 Fact_Table)__
>> Ptr_Parent_Rcd    Ptr_Child_Rcd
>> 		10                20
>> 		10                30
>> 		40                30
> This is clear.
> You try to build self-recursive M : M link on table.
>
>> Lookup table records have to be unique. We have Thomas related to Mary
>> (Lookup_Table first record 10 to 20). We don't need, and so try to
>> prevent, Mary related to Thomas (20 to 10).
>
> Okay I see your task.
>
>     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)))
>
> Aha. So you try to build string that contains 2 numbers sorted in ASC  
> order.
> I see. Correct.
>
> I think you get problems because for cases when ptrs are equal you  
> produce
> string 'False'.
>
> This means that you can have 2 and 3 and more time the same string  
> 'False'.
> And this is why you get NOT UNIQUE error.
>
> Right ?

No. This is not the problem.

>> Base Object Method won't allow import of new Lookup_Table records.
>> Would like to import 50 to 40, 50 to 10, etc. But Base Object Method
>> thinks these are not unique.
>
> Wait. How you are going import values into RecID field ?????
> This is READ ONLY field.

No. This is not the problem either.
I import to Lookup_Table ObjectPtrs. Lookup_Table has Base Object  
Method that is causing problem. It is Lookup_Table that has to have  
unique records. I put data in fact table and collect Fact_Table RecIDs  
first.

I tested with simplest case: new database, one table, two fields (type  
= short), one base object method (unique set to true). No importing, no  
ObjectPtrs, no RecIDs involved.
Still, not able to add records with VAPP interface.

So I moved 'False' to other end of Base Object Method:
if(ptr_parent_rcd>ptr_child_rcd,concat(ptr_parent_rcd,'- 
',ptr_child_rcd),if(ptr_child_rcd>ptr_parent_rcd,concat(ptr_child_rcd,'- 
',ptr_parent_rcd),’False’))
Still not able to add records.

Removed 'False':
if(ptr_parent_rcd>ptr_child_rcd,concat(ptr_parent_rcd,'- 
',ptr_child_rcd),if(ptr_child_rcd>ptr_parent_rcd,concat(ptr_child_rcd,'- 
',ptr_parent_rcd)))
Not able to add records after first record.

Removed nested If statements:
if(num_one>num_two,concat(num_one,'-',num_two),concat(num_two,'- 
',num_one))
Now able to add records. But have to delete existing records first.

I can send simplest case files if you like, or you can create the same  
simple test very easy.

Thanks again,

Thomas


More information about the Valentina mailing list