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

Home » RADICORE » How To » Weird Parent->Child->Child screens help (Sorry for the complexity)
Weird Parent->Child->Child screens help [message #1432] Tue, 08 July 2008 18:24 Go to next message
cpscdave is currently offline  cpscdave
Messages: 20
Registered: June 2006
Junior Member
Hi Tony and everyone else.

What I am playing around with right now is, we have a parent table (campaign). In this table 2 of the columns are source_filename and helper_function.

For the child of this table (entry) I use the source_filename to figure out the class and then call the helper_function to populate the data. (I've done this by modifying a std.list2.inc to call the helper function instead of getData). So entry isn't a table

Specifically the child displays parent_id and parent_name, it is the job of the helper function to return these.

So for the trial run. I have a campaign who's entries are accounts. This all works fine.

However now I would like to add a history table under the entry. But when I set this up no selection is being passed down.

Any ideas of what I'm missing to get this to work??

Hopefully what I'm trying to explain is somewhat clear Smile
Re: Weird Parent->Child->Child screens help [message #1433 is a reply to message #1432] Tue, 08 July 2008 19:33 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
You don't need to modify std.list1.inc to call your helper function instead of getData(). You can use a special class which inherits from 'std.table.class.inc' even though it does not do any database access. Take a look at http://www.tonymarston.net/php-mysql/infrastructure-faq.html #faq57 which describes the use of a virtual table - a class which has no corresponding database table. This describes a task which is available in the Classroom prototype, so you have some working code to examine which you can use to build your own task.

The getData() will by default try to access the database, but after receiving data from the parent class you can turn off the database read and do something else instead. You can even construct the string which is then passed down to the next table class.


Re: Weird Parent->Child->Child screens help [message #1449 is a reply to message #1432] Thu, 10 July 2008 13:15 Go to previous messageGo to next message
cpscdave is currently offline  cpscdave
Messages: 20
Registered: June 2006
Junior Member
Hi Tony,
Thanks for the insight. I have followed the faq and got it to work (spent a good amount of time trying to figure out why it wasn't. I had forgotten to change the inner table from the calculated table name I was using before to the virtual table class opps).

It's working now, the selection is being passed down to the virtual tables child.
However on the list screen for the virutal table it is only giving me one row per page.
Any suggestions on why this would be??
Re: Weird Parent->Child->Child screens help [message #1450 is a reply to message #1449] Thu, 10 July 2008 13:34 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
What value do you have set for $this->rows_per_page for the inner entity? Does your modified LIST2 script have a line which reads $dbinner->setRowsPerPage(1)? How many records actually match your selection criteria?

$this->rows_per_page governs the value of LIMIT which is used in the sql SELECT statement, so if it is only returning 1 then either:
(a) you have set LIMIT to 1, or
(b) only 1 record satisfies the selection criteria


Re: Weird Parent->Child->Child screens help [message #1451 is a reply to message #1450] Thu, 10 July 2008 13:37 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
If you are using a 3 level structure (parent->child->grandchild) then be aware that only the bottom-most level can return more than one row at a time. All the higher levels have an enforced limit of one. This is by design.

Re: Weird Parent->Child->Child screens help [message #1452 is a reply to message #1432] Thu, 10 July 2008 14:54 Go to previous messageGo to next message
cpscdave is currently offline  cpscdave
Messages: 20
Registered: June 2006
Junior Member
So I do have a parent->child->grandchild set up going with the child as the virtual table.

What the issue is on the List2 screen of parent->child. The child records all show up but only 1 per page.
Re: Weird Parent->Child->Child screens help [message #1453 is a reply to message #1452] Thu, 10 July 2008 15:13 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
What sql SELECT statement is the child issuing? Does it contain a LIMIT clause? How many records SHOULD be selected?

Re: Weird Parent->Child->Child screens help [message #1454 is a reply to message #1432] Thu, 10 July 2008 17:09 Go to previous messageGo to next message
cpscdave is currently offline  cpscdave
Messages: 20
Registered: June 2006
Junior Member
Okay I'm thinking that maybe the issue arises from the fact that what I'm trying to do with the virtual table and what you do in your example aren't exactly the same.

What I'm reading in the example when you call $this->getScrollItem($this->pageno)
It returns information on a single record.

For what I'm trying to do. There can be 0-N children. So whats happening is I'm getting N pages with 1 record each instead of N/rowsPerPage pages with rowsPerPage records on it.

Is there a built in function getScrollSet($pageno) that returns what I need??
Re: Weird Parent->Child->Child screens help [message #1455 is a reply to message #1454] Thu, 10 July 2008 17:16 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
You shoud only be using getScrollItem() in the middle entity of a LIST3 screen, so why are you using it as the inner entity of a LIST2 screen?

Re: Weird Parent->Child->Child screens help [message #1456 is a reply to message #1432] Thu, 10 July 2008 17:28 Go to previous messageGo to next message
cpscdave is currently offline  cpscdave
Messages: 20
Registered: June 2006
Junior Member
AHA there's the confusion Smile
Its not a list 3 DOH! Feel kinda silly now


This screen is just a Parent->child relationship. My original inquiry started cause I couldn't get the child->grandchild to work how I was doing it.

My life would be some much easier if people could only read my mind cause apparently I really suck at explaining what I'm trying to do lol
Re: Weird Parent->Child->Child screens help [message #1457 is a reply to message #1456] Thu, 10 July 2008 18:12 Go to previous message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
If you wish to display multiple rows at a time then you must create an sql SELECT statement that retrieves multiple rows. The example that I provided is used for retrieving one row at a time from a virtual table.

Previous Topic: Screen structure reference for filepicker-ed images
Next Topic: proportional scaling of thumbnails in filepicker (for images)
Goto Forum:
  


Current Time: Fri Nov 08 18:44:19 EST 2024

Total time taken to generate the page: 0.01320 seconds