List view (List3) [message #7537] |
Tue, 15 December 2020 16:11 ![Go to next message Go to next message](/theme/default/images/down.png) |
htManager
Messages: 427 Registered: May 2014
|
Senior Member |
|
|
Hello Tony,
how can I show all inner table records of the outer table selection without the middle table records? Is this possible?
Or can I set a filter with the outer table selection to the inner table?
Best regards,
Juergen
|
|
|
Re: List view (List3) [message #7538 is a reply to message #7537] |
Wed, 16 December 2020 04:48 ![Go to previous message Go to previous message](/theme/default/images/up.png) ![Go to next message Go to next message](/theme/default/images/down.png) |
AJM
Messages: 2361 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
No. With a LIST pattern there are 3 tables - outer, middle and inner. Both the outer and middle tables will show only one row while the inner table will show multiple rows. At runtime the primary key of the outer table is passed down to the middle table so that it can read all children of that parent, but only show them one at a time. Then the primary key of the current row in the middle table is passed down to the inner table so that it can read all the children of that middle row, and it will show them in pages.
If you want to bypass the middle table then you should use a LIST2 pattern which does not have a middle table.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: List view (List3) [message #7540 is a reply to message #7539] |
Fri, 18 December 2020 04:48 ![Go to previous message Go to previous message](/theme/default/images/up.png) ![Go to next message Go to next message](/theme/default/images/down.png) |
AJM
Messages: 2361 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
Your original question was "how can I show all inner table records of the outer table selection without the middle table records?" It now seems that you still want to filter the inner table using the middle table, but without showing the inner table. Is this correct? If you don't show the middle table then it is not possible to identify which values from which middle row should be used to filter the inner table. If there are multiple occurrences of the middle table then screen would show hyperlinks which enabled you to scroll through them.
If by the time you get to the _cm_pre_getData() method of the inner table you know what these filer values are you can always add them to $this->sql_search or even the $where string. I do this quite often in my own code, so I know it is possible. The only problem arises if you don't know what these filter values are, but if you don't know what they are I'm afraid that the framework cannot conjure them up for you.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
|
|
|
Re: List view (List3) [message #7546 is a reply to message #7544] |
Sun, 20 December 2020 04:58 ![Go to previous message Go to previous message](/theme/default/images/up.png) ![Go to next message Go to next message](/theme/default/images/down.png) |
AJM
Messages: 2361 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
The getData() method, and therefore the _cm_pre_getData() method, is called each time a web page is built. Once a page has been loaded for the first time and the _cm_pre_getData() method called for the first time, any activities you perform in that page, whether it be pressing a hyperlink or pressing a button, which cause that page to be refreshed will result in repeated calls to getData(). This means that after you have constructed the various SQL component strings the first time you must not allow subsequent calls to _cm_pre_getData() to corrupt those strings.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
Re: List view (List3) [message #7547 is a reply to message #7546] |
Sun, 20 December 2020 07:08 ![Go to previous message Go to previous message](/theme/default/images/up.png) ![Go to next message Go to next message](/theme/default/images/down.png) |
htManager
Messages: 427 Registered: May 2014
|
Senior Member |
|
|
How can I do this best?
I tried it with the following code in the _cm_pre_getData() method (which does not work):
switch ($GLOBALS['task_id']) {
case 'htm_orga_ausruestung_s01_kontakte(list1)':
$where_original = $where;
// filtert die Werte aus orga_mannschaften_kontakte_ausruestung nach den ausgewählten Artikeln
$where = "ma_ausruestung_id='{$GLOBALS['ausr_id']}' AND ma_ausruestung_artikelnummer='{$GLOBALS['ausr_anr']}' AND " .
"ma_ausruestung_rdcaccount_id='{$GLOBALS['ausr_rdc']}' AND " . $where_original;
break;
default:
break;
}
[Updated on: Sun, 20 December 2020 08:15] Report message to a moderator
|
|
|
Re: List view (List3) [message #7548 is a reply to message #7547] |
Mon, 21 December 2020 05:01 ![Go to previous message Go to previous message](/theme/default/images/up.png) ![Go to next message Go to next message](/theme/default/images/down.png) |
AJM
Messages: 2361 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
It is just the WHERE string which is being lost on subsequent calls to _cm_pre_getData(), or is the entire SQL query being altered?
If it is just the WHERE string then, once you have constructed it, you can store it in $this->save_initial_where and this will be used in all subsequent calls to _cm_pre_getData().
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
|
|