Topic: Show child rows depending on focus in mother table

Hello,

I have made a form showing in tablegrid1 all invoices and want to show in tablegrid2 all invoice lines related to the actual row (focus) in tablegrid1.

I have used your invoice example app.

thank you!

2 (edited by derek 2019-12-22 18:33:37)

Re: Show child rows depending on focus in mother table

Hi Pnoindl,
Please have a look at the attached example.
Form1.tablegrid1 shows your invoice headers.
Form1.tablegrid2 shows your invoice lines related to the invoice header row that has been highlighted
The way you link the two tablegrids is by using a button defined with a 'search' action (in my example, this is button4).
Button4 uses form1.tablegrid1 as its search criteria - in other words, whichever row is highlighted in tablegrid1 will display the related child records (invoicelines) in tablegrid2 when form1.button4 is clicked.
To make it more user-friendly, button4 can be hidden and automatically clicked (an 'incremental search'), whenever a different row in form1.tablegrid1 is highlighted - see the screenshot in the attachment to see how this is done.
This is standard MVD functionality and needs no script.
Regards,
Derek.

Post's attachments

Attachment icon pnoindl.zip 494.5 kb, 566 downloads since 2019-12-22 

Re: Show child rows depending on focus in mother table

Many thanks for your quick answer. Just one more question: is it possible to use F-Keys with buttons, e.g. F11 for "New record"?

Re: Show child rows depending on focus in mother table

Hi,
Yes, you can remap any keys you want.
For function keys, please have a look at the attached example (Fkey codes are in the script).
Regards,
Derek.

Post's attachments

Attachment icon remapfunctionkey.zip 336.08 kb, 485 downloads since 2019-12-23 

5 (edited by agusecc 2020-01-11 22:27:06)

Re: Show child rows depending on focus in mother table

Hi Derek,  how to make report sql so can print cflinevalue from table invoiceline?
cause i try eror...

https://www.dropbox.com/s/2npfrzrjcob1y … f.rar?dl=0

Thanks you , agusecc

Post's attachments

Attachment icon eror calculate field by report sql.PNG 94.22 kb, 177 downloads since 2020-01-11 

6 (edited by derek 2020-01-12 18:41:00)

Re: Show child rows depending on focus in mother table

Hi,
Calculated fields are not held in tables, they only exist temporarily as the result of a calculation when your program runs.
In your example, 'price' is held in your invoiceline table and 'quantity' is held in your invoiceline table, but 'linevalue' does not need to be stored in your invoiceline table - it is derived by the calculation of 'price' * 'quantity'.
For this reason, If you use 'reportsql', you can't reference calculated fields because they do not exist! 
However, you simply need to replicate the formula to calculate the linevalue inside your reportsql if you need to see linevalue.
Have a look at the attachment.
Derek.

Post's attachments

Attachment icon reportsqlproblem.zip 340.19 kb, 529 downloads since 2020-01-12 

Re: Show child rows depending on focus in mother table

Hi Derek , excelent

Thanks you verry much for your explain, i get new information about calculate field.