Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Transaction Patterns » List view (List3)
List view (List3) [message #7537] Tue, 15 December 2020 16:11 Go to next message
htManager is currently offline  htManager
Messages: 433
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 messageGo to next message
AJM is currently online  AJM
Messages: 2367
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.


Re: List view (List3) [message #7539 is a reply to message #7538] Thu, 17 December 2020 07:09 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
I tried the list2 pattern but I didn't succeed. The key of the outer table is only part of the key of the inner table and in my list2 screen there are always shown all records of the inner table. That was the reason that I thought that a list3 pattern would fit better. In the middle table there are the missing key values for the inner table.
I tried to modify the $where string in the _cm_initialize() method but I don't know how to get the missing key values for the inner table to show/filter the right occurences.
Re: List view (List3) [message #7540 is a reply to message #7539] Fri, 18 December 2020 04:48 Go to previous messageGo to next message
AJM is currently online  AJM
Messages: 2367
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.


Re: List view (List3) [message #7541 is a reply to message #7540] Fri, 18 December 2020 12:14 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
Yes, you understood right that I actually want to filter the records of the inner table. If I understand you right, it would be best to call a list1 pattern of the inner table and modify the $where clause in the _cm_pre_getData() method with the chosen filter values of the outer table.
As far as I see, I get the filter values in the _cm_initialize() method and in the _cm_pre_getData() method I see all the primary key values. I will try this.
Re: List view (List3) [message #7542 is a reply to message #7541] Fri, 18 December 2020 14:50 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
I have now the result that I want. I can filter the records with the _cm_pre_getData() method. But as soon as I change something in the list view of the sreen as showing 25 reocrds instead of 10, then the records vanish and I see nothing anymore. Do I have to add or change something more in a secord _cm_ method?
Re: List view (List3) [message #7543 is a reply to message #7542] Sat, 19 December 2020 05:11 Go to previous messageGo to next message
AJM is currently online  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
You have to ensure that when you construct the query in the first call to _cm_pre_getData() you do not corrupt it in the second and subsequent calls. You need to examine the first query then compare it with the second query.

Re: List view (List3) [message #7544 is a reply to message #7543] Sat, 19 December 2020 06:06 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
Where can I find the subsequent calls?

I have the following methods in my class file:

_cm_initalise(): I get the values of the outer table in the $where string and store them in $Globals[] for modifying the $where string later
_cm_getValRep(): the $where string is emtpy.
_cm_pregetData(): the original $where string has the value 'rdcaccount_id='7''. I added this original string to my modified string.
_cm_getExtraData() the original $where string has the value 'rdcaccount_id='7''. I added this original string to my modified string before return $fieldarray.

_cm_getInitialDataMultiple(), _cm_popUpReturn() and _cm_postfetchRow() do not have a $where string

Re: List view (List3) [message #7546 is a reply to message #7544] Sun, 20 December 2020 04:58 Go to previous messageGo to next message
AJM is currently online  AJM
Messages: 2367
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.

Re: List view (List3) [message #7547 is a reply to message #7546] Sun, 20 December 2020 07:08 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
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 messageGo to next message
AJM is currently online  AJM
Messages: 2367
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().


Re: List view (List3) [message #7549 is a reply to message #7548] Mon, 21 December 2020 06:30 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
It seems that I am doing something wrong.

It is just the $where string which I alter in the _cm_pre_getData() method. And directly after constructing the new $where string I save it with $this->save_initial_where = $where;

I created a new subclass for this task extending the main class/DefaultTable. Do I have to change or add something in this subclass?
Re: List view (List3) [message #7550 is a reply to message #7549] Tue, 22 December 2020 04:36 Go to previous messageGo to next message
AJM is currently online  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
You need to step through with your debugger to see what is happening to the $where string on the second and subsequent calls to _cm_pre_getData(). Somewhere along the line it is being overwritten, so you need to find out where.

Re: List view (List3) [message #7552 is a reply to message #7550] Sat, 26 December 2020 05:20 Go to previous message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
Then I will try it. Thank you.
Previous Topic: PopUp - Link1 table
Next Topic: Tree structure
Goto Forum:
  


Current Time: Thu Nov 21 04:31:58 EST 2024

Total time taken to generate the page: 0.03193 seconds