database - Pull data from multiple records into one row -
i want pull out data multiple records , insert them different fields of single record in table. work doing requires me pull cw_cat_total
field(which sum of assignments corresponding particular category of assignment , put appropriate data fields of table.
the cw_cat_total
field calculated self-joined relationship. not figure out how individual component different columns of table in second picture.
can filemaker programmers me out here?
update:
my database contains more tables. quite complicated (from point of view). below er graph.
what try achieve pull component scores different columns of results
table student's assignment score may computed different weightings different category. coursework score, student scores examination @ each quarter(term), displayed in reports
table.
as side note, teacher of school (not developer). hence, schema may not industry practiced. did read database normalisation , think understand (which may not, i'm not sure). tried best design around think industry practices. if er graph flawed affect implementing want do, please point out can redesign entire database. need compute overall results (from results
table) base on different weighting of different terms in report of term 4. think problem similar this.
traditional method: (works filemaker 7 onward)
traditionally way in filemaker create additional table occurrences of coursework_results table related on both "_kf_resultid" , on "type".
1: on "results" table create new calculation field each type of coursework_result. let use "classwork" example.
- name new field _k_classwork
- make field type calculation
- set calculation type text
- set calculation return string "classwork"
- uncheck "do not evaluate if referenced fields empty"
repeat process every "type" in "coursework_results" table data.
2: each "type" make new table occurrence of "coursework_results" table. name "coursework_results_classwork". link "results" table in following way:
results::_kp_resultid \____________/ coursework_results_classwork::_kf_resultid results::_k_classwork / \ coursework_results_classwork::type
repeat process every "type" in "coursework_results" table data.
3: set calculation of "classwork_percent" be:
sum ( coursework_results_classwork::mark ) / sum ( coursework_results_classwork::max_mark )
then set other _percent fields similarly, based on own newly created table occurrences. (ex: coursework_results_quiz::mark , coursework_results_project::mark)
execute sql (works filemaker 12)
filemaker 12 gives new executesql step can use skip setting new schema in database. in case, need modify "classwork_percent" field have calculation:
executesql( "select sum(mark) coursework_results _kf_resultid = ?"; ""; ""; _kp_resultid)
for more information check out filemaker's page: http://www.filemaker.com/12help/html/func_ref3.33.6.html
also check out filemaker sql sugar ("@") module building queries: http://www.modularfilemaker.org/2013/03/filemaker-sql-sugar/
Comments
Post a Comment