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

Home » RADICORE » How To » Missing calculated field in relationship
Re: Missing calculated field in relationship [message #2249 is a reply to message #2247] Mon, 10 August 2009 17:07 Go to previous messageGo to previous message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
The table.dict.inc relationship is:
    $this->parent_relations[]               = array('parent' => 'candidate',
                                                    'parent_field' => 'concat(first_name, \' \', last_name) as person_name, age_group_id, dob_date, first_name, last_name, gender, candidate_pin, student_ind, addr_line_1, addr_line_2, addr_line_3, town, county, postcode, email_addr, home_telephone, mobile_telephone',
                                                    'fields' => array('candidate_id' => 'candidate_id',
                                                                      'rdcaccount_id' => 'rdcaccount_id'));


The generated SQL is:
SELECT SQL_CALC_FOUND_ROWS exam.*, branch.branch_id, branch.branch_desc, branch.branch_abbrev, branch.syllabus_type_id, branch.student_branch_abbrev, branch.crf_type_id, branch.session_type_id as branch_session_type_id, 
  concat(candidate.first_name,' ',candidate.last_name) AS person_name,
  d1.dance_code AS dance1_code, d2.dance_code AS dance2_code, d3.dance_code AS dance3_code, d4.dance_code AS dance4_code,
  grade.grade_code, grade.grade_desc, school.school_name, school.principal_name, school.principal_mem_num, school.school_addr_line_1, school.school_addr_line_2, school.school_addr_line_3, school.school_town, school.school_county, school.school_postcode, school.school_email_addr, school.school_web_addr, school.school_telephone,
  session.session_desc, session.session_date, session.examiner, session.session_type_id, amount  
FROM exam  
LEFT JOIN branch ON (branch.branch_id=exam.branch_id)  
LEFT JOIN candidate ON (candidate.candidate_id=exam.candidate_id AND candidate.rdcaccount_id=exam.rdcaccount_id)  
LEFT JOIN dance AS d1 ON (d1.dance_id=exam.dance1_id)  
LEFT JOIN dance AS d2 ON (d2.dance_id=exam.dance2_id)  
LEFT JOIN dance AS d3 ON (d3.dance_id=exam.dance3_id)  
LEFT JOIN dance AS d4 ON (d4.dance_id=exam.dance4_id)  
LEFT JOIN grade ON (grade.grade_id=exam.grade_id)  
LEFT JOIN school ON (school.school_id=exam.rdcaccount_id)  
LEFT JOIN session ON (session.rdcaccount_id=exam.rdcaccount_id AND session.session_id=exam.session_id)  
LEFT JOIN cost_group_charge ON (grade.cost_group_id=cost_group_charge.cost_group_id AND session.session_date >= cost_group_charge.start_date AND session.session_date <= cost_group_charge.end_date AND exam.rdcaccount_id = cost_group_charge.rdcaccount_id AND exam.banner_req = cost_group_charge.banner_req AND cost_group_charge.age_group_id IN  (SELECT candidate.age_group_id from candidate where exam.candidate_id = candidate.candidate_id UNION SELECT age_group.age_group_id from age_group where age_group_id = 'X'))   
WHERE exam.rdcaccount_id='7' AND exam.session_id='1'    
ORDER BY exam.exam_seq_nbr asc  
LIMIT 10 OFFSET 0 =>Count=8


You can see that the items following person_name are not included in the SQL.

Graham
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Use of $this->skip_validation
Next Topic: how can i change a textfield row into dropdown control?
Goto Forum:
  


Current Time: Sun Nov 24 14:38:54 EST 2024

Total time taken to generate the page: 0.01052 seconds