Calc element throws error

venekamp

Member
Hi,

Currently I am working on a geneology app. In this app I have a list: Persoonsgebeurtenissen in which I collect personal events for my geneaology database. This list uses the table fluve_fam_events. Relevant elements for my problem are Id and datum datum is a textfield representing a year with some additional text (examples “1350 -ca” , “1510 –<” , “1744 >-” )

To add persons to teh event I have the repeating group ‘Persons in events” using table fluve_fam_personenbijgebeurtenis that has a database join on fk_gebeurtenis to fluve_fam_events on Id. In this repeating group I have the element datum in which I copy the value from datum in fluve_fam_events. (So I can use the fluve_fam_personenbijgebeurtenis in views that show the timeline for a person)
To do so I made this second element a calc element using this code (based on what I found in WIKI)
<<
$value = {fluve_fam_personenbijgebeurtenis___fk_gebeurtenis_raw};
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery
->select('datum')
->from('fluve_fam_events')
->where('id = '. $myDb->quote( $value ));
$myDb->setQuery($myQuery);
$myvalue = $myDb->loadResult();
Return $myvalue;
>>
Only Calc on Save option is set to “Yes”. Other options are set to “No”
As I expect when I add persons in the intial registration Datum is blanc in the repeating group when I add a person.
Same when I initially create an event without persons and add persons to the event.
In both cases Datum in the repeating group is a copy from the event after saving the form.

However adding a person to an event that already has populated person-groups: When I add a new person the Datum in the persongroup contains the value from event. Then when saving the event I get an error saying “0 syntax error unexpected token ;”
Changes made is an existing person throws the error “0 syntax error unexpected token ,”

adding &fabrikdebug=1 to the URL does not show debug info.
Note: site is not on Internet but under development

upload_2021-12-14_22-39-38.png


upload_2021-12-14_22-40-3.png


upload_2021-12-14_22-40-26.png
 
Last edited:
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top