Page 1 of 1

How do I save the amount and not the id in my database?

Posted: 2023-11-08 18:16
by pasbonte
Good evening

I have a database that works well, the staff enter hours by choosing in a combo field, but the value is always recorded with the id and not with the number, the amount. How do I save the amount and not the id in my database?

How do I save the amount and not the id in my database?

I'm attaching copies to be clearer,

thank you
formulaire
Capture d'écran 2023-11-08 191137.png
Capture d'écran 2023-11-08 191137.png (27.81 KiB) Viewed 2326 times
mysql
Capture d'écran 2023-11-08 191226.png
Capture d'écran 2023-11-08 191226.png (64.48 KiB) Viewed 2326 times
Capture d'écran 2023-11-08 191415.png
Capture d'écran 2023-11-08 191415.png (44.63 KiB) Viewed 2326 times

Re: How do I save the amount and not the id in my database?

Posted: 2023-11-08 18:42
by jsetzer
That's the way lookups work. They store the primary key of the chosen record.

Consider adding another field and configure it as calculated field. The SQL command should fetch the value from the 2nd table where table2.pk=table1.fk

Re: How do I save the amount and not the id in my database?

Posted: 2023-11-09 22:14
by pbottcher
Hi pasbonte,

maybe you explain a bit more what you try to acheive and why you need to store that data in the same table. That could help in finding a solution.

Re: How do I save the amount and not the id in my database?

Posted: 2023-11-09 23:17
by baudwalker
Hi pasbonte,

Have a look at this.

viewtopic.php?f=6&t=2618

Barry