Failure in retrieval when using non-key fields
Author: pari_shelar@yahoo.com (pari_shelar)
Hi,
I am getting one strange behavior; I still don’t know it is strange or fundamental of Uniface. J
I am initializing two fields to table. One is primary key, second is non- primary key and then retrieves the entity. In this case, record is retrieved on the basis of primary key and simply ignores the second field (non-primary key).
e.g.
clear/e "customer"
customerid.customer/init = "1" ; primary key
customerActiveflag.customer/init = "T" ; non primary key field
retrieve/e "customer"
Customerid = 1 fetch valid data but don’t have data where customerActiveflag = ’T’ in database. So it should not retrieve the record but it is retrieving the record on the basis of primary key (customerid = 1).
Note: I tried with different fields with different data type for non primary key field but still result is same.
I don’t know why?
I have two solutions to overcome this issue.
1. Check primary key in read trigger (u_where) & initialize non primary key while retrieving.
2. Use gold equal to (.=) while initializing primary key
e.g.
clear/e "customer"
customerid.customer/init = ".=1" ; primary key
customerActiveflag.customer/init = "T" ; non primary key field
retrieve/e "customer"
In above case, record is not retrieved which is right. I don’t know why it is working with gold equal to and not working with simply initializing the value?
I am using Uniface 9.4 & MS SQL 2005.
Thanks in advance.
