Topic: Wrong connections

Hi everyone,
I was trying to make a program for managing a tech service lab.
I wrapped myself in saving the data of the form 'frmInterventi' in fact I must have made some mess with the tables and the relationships but I just can't find where.
Initially I had set the relationships differently but then I couldn't find the right field to assign to the ComboBoxes.
Thanks to all and greetings.

Post's attachments

Attachment icon Laboratorio.zip 328.5 kb, 135 downloads since 2023-05-27 

Re: Wrong connections

Hi Fabio,
Your relationship on frminterventi is incorrect.
'Stato' is a field held on table 'dispositivo' but you have set a relation from table 'clienti' back to 'dispositivo' and are trying to make 'stato' work as a combobox which doesn't make any sense;  I think the solution is to set up a new 'stato' table with a relationship on 'dispositivo' so you can select whatever 'stato' you need.
Also, there are a couple of options on how your main form should work depending on your business process (basically, do you start with the clienti or do you start with the intervento)?  I would suggest the latter.
Have a look at the attachment as a possible solution.
Derek.

Post's attachments

Attachment icon Laboratorio fixed.zip 343.15 kb, 145 downloads since 2023-05-28 

3 (edited by reteinformatica 2023-05-28 11:20:46)

Re: Wrong connections

Hi Derek and as always thank you very much. My aim would be to be able to display the customer list in the left TableGrid in the first form and by selecting the customer in the right TableGrid, show all the interventions relating to this customer. But I haven't gotten here yet due to the problem I was experiencing that was still to be solved.
Based on your suggestions I made some changes to my initial project and I'm faced with a problem that will be the usual stupidity but from which I can't get out of it.
In the 'frmSettings' form which is then also called by the 'Nuovo stato (New State)' button of the 'frmInterventi' form as well as by the 'Impostazioni (Settings)' button of the first form (frmMain), in the third tab (Stato) there is the TableGrid 'tbStato' which it is configured in exactly the same way as the other two present in the same form.
Only when running the program instead of making me write to create a new record, it opens a ComboBox for me.
I really don't know where to hit my head anymore.
A little help please.
Thank you!

Post's attachments

Attachment icon Laboratorio.zip 328.26 kb, 120 downloads since 2023-05-28 

Re: Wrong connections

Hi Fabio,
Try it something like this as an option.
Once you have configured the basics correctly, only then start to build it up.
Derek.

Post's attachments

Attachment icon Laboratorio2.zip 342.38 kb, 132 downloads since 2023-05-28 

Re: Wrong connections

Hi Derek, Thanks for your input and settings.
Please help me understand why in my project the TableGrid gives me a ComboBox instead of making me write, while in the other two the same thing doesn't happen, because I'm going crazy. Thank you.

Re: Wrong connections

Hi,
You were using the wrong table ('dispositivo' instead of 'statoint').
I'm guessing that you copied it from one of the other tablegrids and didn't change the table (being able to copy objects is a great time saver but it's easy to forget that there will still be things that need changing).
Derek.

Post's attachments

Attachment icon fb screenshot.jpg 64.24 kb, 44 downloads since 2023-05-28 

7 (edited by reteinformatica 2023-05-28 17:38:15)

Re: Wrong connections

I told you it would be silly :-(
But is there a way to enlarge the tablegrids by a certain amount when starting the program? Because they start so narrow.
Thank you!

Re: Wrong connections

It's only an issue the very first time - as soon as there is data in your tablegrid, it should remember the width that you set it do.
However, if you do want to specify column widths,  then you can do it by script (in the form's 'onshow' event)

Form1.TableGrid1.Columns[0].Width := 30;

Or you can actually allow the users to set their own column widths (perhaps useful if they use monitors with different sizes and resolutions).
Derek.

Re: Wrong connections

Ah, I understand, then you can't edit them manually.
I have another question, always related to this project if you don't mind.
'frmSettings' is also called by the 'frmInterventions' buttons. As is easily visible, 3 of these buttons all do the same job: they open 'frmSettings' however in a tab of 'PageContol1' either random or the last one opened.
The improvement I would like to make is that when in 'frmInterventi' a button relating to that specific object to be inserted is pressed, it opens directly in the right tab of 'frmSettings'.
For example if I press the button to enter a "Marca", the "Marca" tab opens.
Thanks as always.

Re: Wrong connections

Try it like this (see attached).
To access the desired 'tabsheet', just click on the relevant label on frminterventi (it's just a preference to use the labels rather than show the button because it keeps the form minimal;  the user still knows that there is functionality associated with the label because the label is underlined and the cursor changes to a 'handpoint').
Also have a look at how the user can change the default column widths (log off and log back on to see it take effect).
Derek.

Post's attachments

Attachment icon Laboratorio fixed2.zip 344.57 kb, 132 downloads since 2023-05-28 

Re: Wrong connections

derek, i never know how to thank you even for the explanations.

12 (edited by reteinformatica 2023-05-29 19:13:06)

Re: Wrong connections

Hi Derek, hi everyone.
Also in this project I tried to make the e-mail address within an Edit clickable to open it with an e-mail client.
I gave birth to this horrendous thing that obviously doesn't work:

procedure frmClients_edEmail_OnClick (Sender: TObject);
var mail: string;
begin
  mail := frmClients.edEmail.text;
  mailto: (mail)
end;

A little help please.

Post's attachments

Attachment icon Laboratorio2.zip 402.1 kb, 135 downloads since 2023-05-29 

13 (edited by domebil 2023-05-30 05:30:30)

Re: Wrong connections

Ciao Fabio o corretto, ora puoi inviare la mail sia facendo doppio clic sulla mail o premendo il bottone laterale, quest'ultimo verifica pure se è una mail
è corretta

Post's attachments

Attachment icon Laboratorio 3.rar 578.38 kb, 135 downloads since 2023-05-30 

Domebil

14 (edited by reteinformatica 2023-05-30 10:54:22)

Re: Wrong connections

Ciao Domenico,
perfetto, proprio quello che volevo facesse il programma. Ho apprezzato anche il tasto che da anche un po' di colore alla finestra oltre a controllare se l'indirizzo e-mail è scritto correttamente.
Grazie mille!

15 (edited by reteinformatica 2023-06-05 21:07:10)

Re: Wrong connections

Hi everyone,
I'm continuing with this project and I've reached the point where this strange thing happens to me:
I insert an intervention (button 'bAggiungiIntervneto in the first form 'frmMain'). Then I'm going to edit this record by clicking on it twice. We immediately see that the first field which is a counter (Numero intervento) is empty instead of having the intervention number which still appears in the TableGrid. Then also the data in the comboboxes are not there. But the strangest thing is that if I save without entering the client the record disappears.
Should I use another form to make edits using editbox instead of combobox? But then I think I would run into errors being the fields in different tables.
I ask for help please. Thank you!

Post's attachments

Attachment icon Laboratorio.zip 405.57 kb, 108 downloads since 2023-06-05 

Re: Wrong connections

The counter property in frmInterventi should match the table Intervento, doing so makes it work, no, the data in the combobox are retrieved but are indexed in a weird fashion...

Re: Wrong connections

Ciao Fabio, Tcoton,
As Tcoton has already identified, 'frminterventi' was using the 'clienti' counter and not the 'intervento' counter.
Additionally, your relationships on 'frminterventi' (cbcliente, cbmarca, cbtipo and cbstato) were set up incorrectly.
Should be working in the attachment.
Derek.

Post's attachments

Attachment icon Laboratorio fixed.zip 419.83 kb, 138 downloads since 2023-06-06 

Re: Wrong connections

tcoton wrote:

The counter property in frmInterventi should match the table Intervento, doing so makes it work, no, the data in the combobox are retrieved but are indexed in a weird fashion...

Hi Tcoton,
during production i changed the name to the table and in some check i forgot to make the changes. Thanks for the hint.

Re: Wrong connections

derek wrote:

Ciao Fabio, Tcoton,
As Tcoton has already identified, 'frminterventi' was using the 'clienti' counter and not the 'intervento' counter.
Additionally, your relationships on 'frminterventi' (cbcliente, cbmarca, cbtipo and cbstato) were set up incorrectly.
Should be working in the attachment.
Derek.

Hi Derek,
I knew it would be stupid. Same reason as Tcoton's answer: I changed the table name and forgot to change the controls configuration. I always get lost in nonsense. Thank you so much derek, always kind and helpful.