Topic: Combobox not saving values

Hi

Can someone please help. I am experiencing a problem with a combox not saving the values to a table.

So, I have a cost centre table and a country table. Both have "country" as a text field. The country table is marked as a dictionary. When I select a company from the combobox on the cost centre form and save the record, it does one of two things. It either:

1. Populates the country field in the cost centre table with a digit

OR

2. It just doesn't save the selected country to the country field in the cost centre table.

I have created relationships.

Re: Combobox not saving values

Hi Colintrent,
If you can attach your project it's a great help - saves any guesswork as to what might not be set up correctly.
To attach your project, delete the .exe file and then zip the folder where you project is located.
Regards,
Derek.

Re: Combobox not saving values

Hi Derek

Thanks for your quick reply.

I have attached the file. Sorry i got my fields confused. I am trying to add a new company location and and choose a company from my "companies" table to save in my "company location table" Sorry for all the confusion.

Now Im getting a sql error.

Please could you show me where Im going wrong.

Post's attachments

Attachment icon Blu.zip 342.68 kb, 35 downloads since 2022-11-02 

Re: Combobox not saving values

Hi,
The error is because, in your data schema, you have left 'id_countries' in the 'org_company_locations' table even though there is no longer a 'countries' table (see the screenshot in the attachment).
The options are either to take it out (which is what I've done in the attachment) or re-create the 'countries' table and keep the link in the 'org_company_locations' table (in this case, you'd have no need for the 'country' text field as it's just duplication).
Personally, I'd got with using a 'countries' table because of data integrity but I appreciate that at this early stage in your project, you're probably just trying various things out.
Looking back to your previous attachment (which you've now deleted), one option to consider for all of your 'dictionary' tables might be to maintain them using 'editable grids' - it significantly reduces the overhead in terms of the number of forms, time to load etc and also saves you personally a lot of time.
Regards,
Derek.

Post's attachments

Attachment icon BluHR fixed.zip 376.08 kb, 35 downloads since 2022-11-02 

Re: Combobox not saving values

Thank you so much for the help and advice Derek. I think I know what you mean now.

I just deleted a lot of the tables in my original attachment to avoid confusion.

Just a question... When using fixed version, do you maybe know why when I select a company, it stores a digit  (see screenshot) and not text?

Post's attachments

Attachment icon Picture1.png 489.39 kb, 16 downloads since 2022-11-02 

Re: Combobox not saving values

Hi Colintrent, привіт Derek )


In the tablegrid you choose not the company name but its ID index in the list. Look at the picture. Red is what to remove and green is what to add.

Post's attachments

Attachment icon 2022-11-02_221000.jpg 21.72 kb, 15 downloads since 2022-11-02 

Re: Combobox not saving values

Wow thank you so much for this solution Sparrow.

i have been trying to figure this out. Thank you everyone for your help

Re: Combobox not saving values

Hi,
Yes, it's because you've asked it to display 'org_company_locations.id_org_companies' (ie the internal key to the 'company' on the 'org_company_locations' table) rather than 'company' from the 'org_companies.company' table (see the attachment where it should now be displaying the company name).
Derek.

Post's attachments

Attachment icon BluHR fixed2.zip 341.11 kb, 45 downloads since 2022-11-02