solution request for duplicate field caption

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
ushay
Veteran Member
Posts: 54
Joined: 2020-06-26 21:30

solution request for duplicate field caption

Post by ushay » 2023-04-09 08:33

hello,

i have a table with 3 different type of customers, for each type i wish to store 2 contact persons and 2 phone numbers.
because every field must have an unique caption i had to give the fileds names with number - contact1,contact2....contact6 and phone1...phone6, but it doesn't look good.
i wish to have for each type of customer - contact1,contact2 and phone1 and phone2, is there any way i can do it please?


Shay.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: solution request for duplicate field caption

Post by jsetzer » 2023-04-09 10:15

One rule in database development is: don't repeat similar fields in the same table.

You should consider adding a contacts table and use a lookup field for referencing your customers table.

Then each customer may have 0 to n contacts.

Same with phone numbers. Add a table for phone numbers. Add a lookup column, referencing the parent contact. This means every contact may have 0 to m phone numbers.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

ushay
Veteran Member
Posts: 54
Joined: 2020-06-26 21:30

Re: solution request for duplicate field caption

Post by ushay » 2023-04-09 10:50

Dear Jsetzer,

the feilds names are obviously diffrent , but why does the captions have to be diffrent?

shay.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: solution request for duplicate field caption

Post by jsetzer » 2023-04-09 11:52

Maybe because it would be confusing for the users and a "No Go" for developers to have different but similar fields in the same table with identical labels.

As mentioned above: Developers should always try to normalize databases. Normalization includes moving data of similar kind into a separate table.

Imagine, in a week or so, you need to store additional information per phone number, for example phone number type like "private", "office", "fax", .... if you have a separate table, it is just one more field. But if you follow your first idea, you'd need n more fields like phone_1_type, phone_2_type, phone_3_type, ... phone_n_type. So, there is good reason for normalizing tables. Any follow up change has to be made n times.

But if you really want identical labels, you can use Javascript on the <label/> elements and change every label's text.

From my experience I would avoid that on any cost for future options and better maintainability, but this is only my opinion.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

ushay
Veteran Member
Posts: 54
Joined: 2020-06-26 21:30

Re: solution request for duplicate field caption

Post by ushay » 2023-04-09 18:46

dear Jsetzer,

ok understood, thank you very much.

Post Reply