This topic is locked

table link - child records

2/10/2012 1:30:16 PM
PHPRunner General questions
S
srfrancesco author

hi,

I created a relationship with a "table link function" to make a matching between two tables( taba, tab<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=19020&image=1&table=forumtopics' class='bbc_emoticon' alt='B)' />

and see child records(linked fields are: tab_a.tipo ON tab_b.tipo) then I had to modify the sql to add some conditions,

here's the code:

SELECT

tab_a.ID,

tab_a.id_agenzia,

tab_a.id_operatore,

tab_a.id_agente,

FROM tab_a

INNER JOIN tab_b ON tab_a.tipo = tab_b.tipo

WHERE tab_a.prezzo BETWEEN (tab_b.prezzo_max 0.7) AND (tab_b.prezzo_max 1.3)
Unfortunately the list page returns a number of child records that do not match the between condition in sql.

How do I modify the sql generated from "table link function"???
thanks

W
wpl 2/28/2012

Hello,
I would also be interested in this topic. Still no idea around?

Sergey Kornilov admin 2/28/2012

I guess you need to modify child table SQL Query adding the same WHERE clause to filter data.

W
wpl 2/28/2012



I guess you need to modify child table SQL Query adding the same WHERE clause to filter data.


Sergey,
but that's where the problem comes from: the details table has got a working where clause (using whereAdd) but child count and details popup of the master table will still display the number of records in the unfiltered table.
thanks for your efforts

Sergey Kornilov admin 2/28/2012

I talking about modifying SQL Query right in PHPRunner, on SQL Query screen.

W
wpl 2/28/2012



I talking about modifying SQL Query right in PHPRunner, on SQL Query screen.


Sergey,
well, I know this will work. But I think this is a question of dynamically filtering the details tables.

S
srfrancesco author 2/29/2012



Sergey,
well, I know this will work. But I think this is a question of dynamically filtering the details tables.


Hi,

I solved the problem adding select count in sql and using a search string for detail table link(for filtering),

overriding the variables in list page event after record processed:

$record [tab_a_childnumber'] with query select count results

and $record ["tab_a_dtablelink_attrs"] with search string url to force sql in detail table list

W
wpl 2/29/2012



Hi,

I solved the problem adding select count in sql and using a search string for detail table link(for filtering),

overriding the variables in list page event after record processed:

$record [tab_a_childnumber'] with query select count results

and $record ["tab_a_dtablelink_attrs"] with search string url to force sql in detail table list


Francesco,
thanks for sharing this. I'll give it a try.