Jump to content

UniDBLookupComboBox: How can i add unique number in tabel - if item is selected?


erich.wanker

Recommended Posts

Hi: 

Question-example - i have 2 tables:

table1: colors

fields:  color_id, color_name

 

table2: master_thing

fields: painting_id, painting_name , color_id, color_name

 

if a user select a color in a UniDBLookupComboBox (items are from table colors) - in table master_thing should store 2 values (color_id, color_name)

 

ThanX for suggestions

Erich

Link to comment
Share on other sites

Hi Erich

 

In table2 you create a lookup field, let's say showColorName:

Lookup definition:

  • Key Fields : color_id
  • Dataset : colors
  • Lookup keys : color_id
  • Result field : color_name

For selecting the color you use a dblookupcombox so:

  • datafield : color_id
  • dataset : master_thing
  • listsource: colors
  • listfield: color_name
  • keyfield: color_id

When user selects a color from the colors table the color_id is stored in datafield and dataset

For saving the name you can then use a table2.onbeforepost with something like:

table2.color_name.value := table2.showColorName.value

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...