Custom Primary Key

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Custom Primary Key

Postby mjekl » Wed Mar 02, 2005 10:59 pm

Hi All,

I'm in the process of converting a Filemaker solution that generates primary keys like:

05C0001
05C0002
...

The idea behind these kind of keys are giving just a little valuable info to the user:

05 => is from year 2005
C => is a credit note
0001 => is credit note unique ordinal number (key)

I would like to keep on using this primary key format for a number of reasons. But Servoy doesn't accept characters in it's primary keys - they are allways integers.

I know I can make these managed from the database (firebird is the most likely candidate), but in order to keep the solution database agnostic I would really love to accomplish this from Servoy. Is there a way to make this in Servoy?

Txs,

Miguel
mjekl
 
Posts: 114
Joined: Sat Nov 13, 2004 10:17 pm
Location: Lisbon

Postby bobcart » Thu Mar 03, 2005 6:08 am

Servoy requires an int for the pk. However, you could always use another column for a computed key with whatever you want.
bobcart
 
Posts: 214
Joined: Fri Nov 21, 2003 8:01 pm
Location: Melbourne (AUS)

Txs

Postby mjekl » Fri Mar 04, 2005 1:23 pm

bob cart wrote:Servoy requires an int for the pk. However, you could always use another column for a computed key with whatever you want.


I see. If I use the key in the calculated column the I can garantee it's uniqueness. Great solution!

Txs,
mjekl
mjekl
 
Posts: 114
Joined: Sat Nov 13, 2004 10:17 pm
Location: Lisbon

Postby bobcart » Fri Mar 04, 2005 9:47 pm

Just remember that some servoy functions work on the actual PK. As long as you keep that in mind, it should work fine.
bobcart
 
Posts: 214
Joined: Fri Nov 21, 2003 8:01 pm
Location: Melbourne (AUS)

Postby mjekl » Mon Mar 07, 2005 3:06 pm

Thanks Bob for all the help.

Miguel
mjekl
 
Posts: 114
Joined: Sat Nov 13, 2004 10:17 pm
Location: Lisbon


Return to Programming with Servoy

Who is online

Users browsing this forum: Google [Bot] and 9 guests

cron