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

Home » RADICORE » How To » std.list3 problem
std.list3 problem [message #360] Mon, 06 November 2006 03:28 Go to next message
johandewit is currently offline  johandewit
Messages: 25
Registered: May 2006
Location: Belgium
Junior Member
Hi,

Using the list3 pattern, the parent part is not displayed.
The xml file seems ok, all data is there for the three tables.

Tables involved :

user

input, both for child and parent.

Parent - displays user related data
Child - displays week related data
Grandchild - diplays lines relevant for the selected week.

The std.list3 pattern is used without a prvious form, so I don't have a $selection criteria. The user data I want to display is that of the user logged in the system.

I think i solved this by generating a $where string in the _cm_initialize() function of my user class.

function _cm_initialise($where)
{
if ( $GLOBALS['task_id'] == 'ts_in_input(list3)' )
{
if (empty($where))
{
if (!empty($_SESSION['logon_user_id'])) {
$where = 'log = "' . strtolower($_SESSION['logon_user_id']) . '"';
if ($this->getCount($where) == 1 )
{
// create a new object, to keep this ine clean.
$tmp_object=new $this->tablename;
$fieldarray = $tmp_object->getData_raw($where);
$where_array= $tmp_object->getPkeyArray($fieldarray);
$where = array2where($where_array);
} else {
$where= NULL; // not a regular user
}
}
}
}
return $where;
}

The child part is an extended class of the input class, which contains all inputted data. It calculates some week related fields.

The grandchild then displays the data entered by the user for the selected week, but is empty at the moment.

I suspect I have to set some properties in the user class, but just don't know which one.

Meanly that's why i used another user object, to keep the current one clean, and I only creates the where string, just to avoid to set everything by hand for the user instance.

I included the generetated xml file.

Is there a way in radicore to test an xmkl file, so one can change this file by hand to discover which setting causes the touble ?

greetings

Re: std.list3 problem [message #361 is a reply to message #360] Mon, 06 November 2006 04:52 Go to previous messageGo to next message
johandewit is currently offline  johandewit
Messages: 25
Registered: May 2006
Location: Belgium
Junior Member
Looking further into my problem, I suspect the following causes the parent fields not displaying :

In the xm the data has following xml structure :

<user>
userfields
<input_week>
input_week fields
<input/> (corerct since table empty
</input_week>
</user>

The user table is part of another subsystem, havin a differnet database. The structure xml part shows :

<structure>
<outer id="aasa_user.user">
--> data
</outer>
<middle id="input_week">
--> data
</middle>
<inner id="input">
--> data
</input>
</structure>

just checked the scripts, and I only used the short table name 'user', Somewhere during the processing, the datyabase is prepended to the table name.

Start looking for it right now

Johan





Re: std.list3 problem [message #362 is a reply to message #361] Mon, 06 November 2006 08:30 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
The XSL stylesheet is looking for elements in the XML document with the identity of "aasa_user.user" which do not exist. They have the name "user" instead. I cannot understand why this is happening.

If you look in file include.xml.php4.inc you will see in function addData2XMLdoc() a call to $dbobject->getClassName() which provides the element identity for writing data from that object out to the XL document. The getClassName() function exists within file std.table.class.inc.

Can you step through with your debugger and see what is happening at that point?


[Updated on: Mon, 06 November 2006 08:30]

Report message to a moderator

Re: std.list3 problem [message #363 is a reply to message #362] Mon, 06 November 2006 09:31 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
The problem looks to be in your screen structure file which (I'm guessing here) contains the line:
$structure['tables']['outer'] = 'aasa_user.user';

instead of
$structure['tables']['outer'] = 'user';

It must contain ONLY the table name, not the table name prefixed with the database name. That is why there is a mismatch in the XML document between the data entry and the structure entry. The two names must match EXACTLY, in case as well as spelling.


Re: std.list3 problem [message #364 is a reply to message #362] Mon, 06 November 2006 09:56 Go to previous messageGo to next message
johandewit is currently offline  johandewit
Messages: 25
Registered: May 2006
Location: Belgium
Junior Member
file include.xml.php5.inc :
function addData2XMLdoc() :

The $object seems ok, $object->tablename = user
$object->dbname=aasa_user

global $screen_structure has following contents :
$screen_structure['xsl_file']=std.list3.xsl
$screen_structure['tables']['outer']=aasa_user.user
$screen_structure['tables']['middle']=input_week
$screen_structure['tables']['inner']=input


$objectname=$dbobject->getClassName() contains user

There is a mismatch between the $screen_structure and the
$objectname.

FOUND IT !!!!!

The problem is me ! $screen_structure is the file
screens/en/input.list3.screen.inc where the outer tablename is defined. There I used the qualified tablename, because i'm using two different databases. This is not a good idea and i shouldn't do that ever again.

Thanks a lot to point me to the correct direction to find my mistake.

Result is attached in image.

Greetings

Johan


Re: std.list3 problem [message #365 is a reply to message #364] Mon, 06 November 2006 11:16 Go to previous message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
Glad you got it fixed.

For your information the only place where you need to specify any database names (apart from the database table classes) is where you want to access tables in different databases in the same SQL query. In all other cases the database name is assumed to be the "current" database name, as declared in the database table class.

In patterns such as LIST3 where you supply several different table names you do not need to specify database names as each table is accessed in a separate SQL query. The only requirement is that the table names for each zone is unique, so if you want to access the same table more than once you can provide an alias name by using a subclass.


Previous Topic: how to handle blobs?
Next Topic: File picker
Goto Forum:
  


Current Time: Fri Apr 19 21:11:38 EDT 2024

Total time taken to generate the page: 0.01225 seconds