1. Erik Segerdell
  2. Valentina Studio
  3. Tuesday, February 26 2019, 09:26 PM
  4.  Subscribe via email
Hello -- We'd like to customize the items in a combo box in a form, so that users will choose from meaningful text labels which would be mapped to the actual values that are recorded in the database. For example, there might a Lab table with 3 rows:

id, name
1, Darwin
2, Einstein
3, Curie

An Experiment table would have a 'lab' field which references 'id' in the Lab table. There will be a form for entering data into the Experiment table. We'd like users to see the items from Lab 'name' in a combo box ('Darwin', 'Einstein', and 'Curie'), but based on their choice, either '1', '2', or '3' would be recorded in the Experiment 'lab' field. Is it possible to set it up this way?

Thanks!
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
Hello Greg,

It was possible to set aliases for items in ComboBox but there was an issue with adding a record, now it is resolved in version 9.8.2, which is available for download.

So here's the example.

There are two tables

  • "country" with fields "country" (name) and "country_id"
  • "city" with fields "city" (name), "city_id" and "country_id"


"city" is linked to "country" using the foreign key on "country_id" fields.

The task is to create a form which adds a new city and allows the user to select the country name from the list (and not the country numeric identifier).

1. Create a form for "city" table with fields "city" and "country_id", select "Columnar" layout and Data Mode "Add"
2. Delete "country_id" LineEdit - Field control and add ComboBox - Field to the form and select "country_id" field
3. Edit Items property and select "country_id" field in the "country" table
4. Edit Aliases property and select "country" field in the "country" table
5. Execute
Attachments (4)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 1
Greg_O Accepted Answer
Great, that's exciting.. will check back in a few days' time...
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 2
Sergey Pashkov Accepted Answer
Hello Greg,

It is marked as implemented, I'll add more details shortly.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 3
Greg_O Accepted Answer
I've just spend a good few hours trying to get that to work thinking I must be doing something wrong. Turns out it's not possible at the moment :(

I got really excited yesterday when I found Valentina Studio thinking I could create a DB-driven app using the forms functionality. However, the lack of such basic functionality stops me in my tracks.

For example, I need to be able to create a new entry in an Albums table. Any new record in the table need to reference the Artists table. Thy Artists table contains Artist_id field (primary key) and Name. When adding a new album record (Album name, release date, Artist_id) though a form I need to be able to select the artist by his name (e.g. Metallica) but have the Artist_id value (e.g 45) recorded instead so the two tables are linked. I can't expect end users to be looking up IDs whenever they need to update / add new records...

Is there any update on this functionality?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 4
Sergey Pashkov Accepted Answer
Hello Erik,

It’s not implemented but we have this task. We’ll try to implement it in the nearest time.
References
  1. https://valentina-db.com/bt/view.php?id=8271
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 5
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.