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.
Martha Weller Accepted Answer
Thanks! I just didn't see those field types.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 1
Sergey Pashkov Accepted Answer
Hello Martha,

Just use the "ComboBox - Field" control from the Database group, it has the Field property, so it is attached to the field.
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 2
Martha Weller Accepted Answer
I am trying to use the combobox with items and alias as in this example. I have 2 tables: vendors and invoices. Vendors' primary key is vendorID. I have a field in invoices that is also vendorID. I used the diagram editor to create a foreign key link one to many. I am editing an AddInvoice form. I have attached an image. Your example shows separate properties for field, items, and aliases. I am running Valentina Studio Pro version 13.0.3 on mac os Ventura 13.2.1. I thought setting the items would pull actual vendorID number from the vendors table with the user being able to see the record's corresponding vendorName (from the alias). I don't seem to be able to actually save any data to the field when I add a record. The record is created; the vendorID field remains null. I don't understand why there is no longer a field property for the combobox. What am I missing? Do I have to do something more? Help!!!! I am not new to sql, but totally new to Valentina.
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 3
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. # 4
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. # 5
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. # 6
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. # 7
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. # 8
  • Page :
  • 1


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

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories