POPUPs do not display [message #1030] |
Mon, 06 August 2007 14:01 ![Go to next message Go to next message](/theme/default/images/down.png) |
adamsp
Messages: 32 Registered: July 2007
|
Member |
|
|
My database has independent tables GRANTS and STAFF and dependent table GRANT_STAFF. I have setup a task that lists (LIST1) staff working on a grant on the Radicore navigation bar and allows selection for editing the GRANT_STAFF record.
My problem: The grant and staff are stored as numeric codes and I want a popup for each. But the codes are NOT being converted (i.e.the number codes are being displayed). Can you give me any idea where to solve this problem?
1. I setup relations from GRANTS and STAFF to GRANT_STAFF.
2. In the GRANT_STAFF table, columns grant_pk and staff_pk (primary keys to the 2 tables) have Control = POPUP, Foreign Fields points to the text field I want to display in the GRANTS or STAFF table. Task ID points to "div_grantstaff_grant2(popup2)" and "div_grantstaff_staff2(popup2)".
Here is a little code from grant_staff.dict.inc
$fieldspec['grant_pk'] = array('type' => 'integer',
'size' => 5, 'minvalue' => 0, 'maxvalue' => 65535,
'pkey' => 'y', 'required' => 'y',
'control' => 'popup',
'task_id' => div_grantstaff_grant2(popup2)',
'foreign_field' => 'title_full');
$fieldspec['staff_pk'] = array('type' => 'integer',
'size' => 5, 'minvalue' => 0, 'maxvalue' => 65535,
'pkey' => 'y', 'required' => 'y',
'control' => 'popup',
'task_id' => 'div_grantstaff_staff2(popup2)',
'foreign_field' => 'lname');
// parent relationship details
$this->parent_relations[] = array('parent' => 'grants',
'parent_field' => 'grant_pk',
'fields' => array('grant_pk' => 'grant_pk'));
$this->parent_relations[] = array('parent' => 'staff',
'parent_field' => 'staff_pk',
'fields' => array('staff_pk' => 'staff_pk'));
|
|
|
|
Re: POPUPs do not display [message #1034 is a reply to message #1030] |
Tue, 07 August 2007 07:37 ![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) |
adamsp
Messages: 32 Registered: July 2007
|
Member |
|
|
Yes, it is as you point out, the parent_field must be correctly specified...I guess I though that the Relationship between the snr and jnr tables referred exclusively to the primary-foreign key relationship. I now understand that, in addition, this relationship points to a field, called the parent_field (single or calculated) that can be retrieved in a popup. I also now see that the "Foreign Field" entry on the Update Column screen must exactly match with this parent_field when the control type=POPUP. Obviously, this was not clear to me.
Finally, when I create a calculated field in the Relationship by setting Parent_field = CALCULATED and Calculated Field as
"CONCAT(fname, ' ',lname) AS fullname"
and I also set the "Foreign Field" on the Update Column screen to "fullname"
I see that Radicore adds slashes to the Calculated Filed...
CONCAT(fname, \' \', lname) AS fullname
In addition I get an error when calling the screen...
Fatal Error: MySQL error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\' \', lname) AS fullname FROM grant_staff LEFT JOIN grants ON (grants.grant_pk=' at line 1 (# 1064).
SQL query: SELECT SQL_CALC_FOUND_ROWS grant_staff.*, grants.grant_pk, CONCAT(fname, \' \', lname) AS fullname FROM grant_staff LEFT JOIN grants ON (grants.grant_pk=grant_staff.grant_pk) LEFT JOIN staff ON (staff.staff_pk=grant_staff.staff_pk) WHERE grant_staff.grant_pk='3' LIMIT 25 OFFSET 0
Error in line 404 of file 'C:\xampp\htdocs\radicore\includes\dml.mysqli.class.inc'.
Please advise.
|
|
|
Re: POPUPs do not display [message #1035 is a reply to message #1034] |
Tue, 07 August 2007 08:32 ![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 |
|
|
Quote: | I see that Radicore adds slashes to the Calculated Filed...
CONCAT(fname, \' \', lname) AS fullname
|
Not on my system it doesn't. If you load in the data for the XAMPLE subsystem you will the CONCAT() function in use on the relationship between X_PERSON and X_PERSON_ADDR, and it does not have any slashes - at least not on the screen. They are visible inside the x_person_addr.dict.inc file but that is only because the string is enclosed in single quotes.
I suggest you remove the backslashes from the relationship screen, re-export the dictionary data, then try running the code again.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
Re: POPUPs do not display [message #1036 is a reply to message #1035] |
Tue, 07 August 2007 09:06 ![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) |
adamsp
Messages: 32 Registered: July 2007
|
Member |
|
|
On the Update Relationship screen with snr=STAFF and jnr=GRANT_STAFF, I set Parent Field = CALCULATED and Calculated Field =
concat(fname, ' ', lname) as fullname
After clicking SUBMIT or SUBMIT+next the Calculated Field shows
concat(fname, \' \', lname) as fullname
My \radicore\htaccess.txt includes...
php_value register_globals 0
php_value magic_quotes_gpc 0
php_value magic_quotes_runtime 0
php_value magic_quotes_sybase 0
After Export-to-PHP the grant_staff.dict.inc includes...
$this->parent_relations[] = array('parent' => 'staff',
'parent_field' => 'concat(fname, \\\' \\\', lname) as fullname',
'fields' => array('staff_pk' => 'staff_pk'));
If I manually edit the above reference (in grant_staff.dict.inc to
'parent_field' => 'concat(fname, \' \', lname) as fullname',
it works as intended.
[Updated on: Tue, 07 August 2007 09:24] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|