Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String vs. Integer PK values.
Message
 
To
27/07/2009 11:35:08
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01414751
Message ID:
01414985
Views:
56
Hi Matt,

> please confirm that it is valid/reasonable to let a user enter a string into a lookup box that matches a string-based PO# or JobNo reference, like "MS3424C" or "UR-23423A" and then I have to do an intermediate lookup to search for the corresponding Integer PK.

A business object absolutely can have methods that take a non-PK identifier. You don't even have to translate this to an integer PK for the query, as long as your links are done on the PK. Simplified:
PROCEDURE GetCustomerByCustomerNo(tcCustNo)
  SELECT ... ;
    FROM Customers ;
   JOIN Addresses ON Customer.pk == Addresses.CustFK ;
   WHERE CustNo = tcCustNo
ENDPROC
Key point is that these values should never make it from the WHERE clause into the JOIN clause.
--
Christof
Previous
Reply
Map
View

Click here to load this message in the networking platform