Page 1 of 1
Error when using lookup in a subform
Posted: Sat May 28, 2022 11:15 pm
by gerese
The error occurs when I use Lookup in the subform to select information from a form. If the selection form contains text fields, the lookup works correctly, if the form is more complex it displays an error.
error lookup.gif
05-28-2022_195012_nuBuilder_backup.sql.gzip
-When I created the clean test the first 2 forms had the same code and description.
Untitled.jpg
Re: Error when using lookup in a subform
Posted: Mon May 30, 2022 7:37 am
by kev1n
Thanks for the bug report.
The issue is caused by the functions in BB that are declared again for some reason.
The workaround for now is to clone the user form and remove the BB code + filters in the custom code.
Re: Error when using lookup in a subform
Posted: Mon Jun 13, 2022 10:38 am
by kev1n
Try this patch (run in phpMyAdmin):
Code: Select all
REPLACE INTO `zzzzsys_php` (`zzzzsys_php_id`, `sph_code`, `sph_description`, `sph_group`, `sph_php`, `sph_run`, `sph_zzzzsys_form_id`, `sph_system`, `sph_global`, `sph_hide`) VALUES ('nuuser_BB', 'nuuser_BB', 'System PHP', 'nubuilder', '$addCode = isset($_SESSION[\'nubuilder_session_data\'][\'USER_CODE_LABEL\']) ? $_SESSION[\'nubuilder_session_data\'][\'USER_CODE_LABEL\'] : \'\';\r\n$j = \" if (\'$addCode\' !== \'\') { $(\'#nusort_5\').html(\'$addCode\') };\";\r\n\r\n$sqlPosition = function() {\r\n $sql = \" SELECT DISTINCT `sus_position` FROM `zzzzsys_user` WHERE IFNULL(`sus_position`,\'\') <> \'\' ORDER BY `sus_position` \";\r\n return $sql;\r\n};\r\n\r\n$sqlTeam = function() {\r\n $sql = \" SELECT DISTINCT `sus_team` FROM `zzzzsys_user` WHERE IFNULL(`sus_team`,\'\') <> \'\' ORDER BY `sus_team` \";\r\n return $sql;\r\n};\r\n\r\n$sqlDepartment = function() {\r\n $sql = \" SELECT DISTINCT `sus_department` FROM `zzzzsys_user` WHERE IFNULL(`sus_department`,\'\') <> \'\' ORDER BY `sus_department` \";\r\n return $sql;\r\n};\r\n\r\n$sqlLanguage = function() {\r\n $sql = \" SELECT DISTINCT `sus_language` FROM `zzzzsys_user` WHERE IFNULL(`sus_language`,\'\') <> \'\' ORDER BY `sus_language` \";\r\n return $sql;\r\n};\r\n\r\n$sqlAccessLevel = function() {\r\n $sql = \" SELECT DISTINCT CONCAT(sal_code,\' : \',sal_description) FROM `zzzzsys_user`\r\n INNER JOIN zzzzsys_access ON zzzzsys_access_id = sus_zzzzsys_access_id ORDER BY sal_code \";\r\n return $sql;\r\n};\r\n\r\n$getBase64JsonDTString = function($sql) {\r\n $result = nuRunQuery($sql);\r\n $a = [];\r\n $a[] = \'\';\r\n while ($row = db_fetch_row($result)) {\r\n $a[] = $row;\r\n }\r\n return base64_encode(json_encode($a));\r\n};\r\n\r\n$position = $getBase64JsonDTString($sqlPosition());\r\n$team = $getBase64JsonDTString($sqlTeam());\r\n$department = $getBase64JsonDTString($sqlDepartment());\r\n$language = $getBase64JsonDTString($sqlLanguage());\r\n$accessLevel = $getBase64JsonDTString($sqlAccessLevel());\r\n\r\n$js = \"\r\n\r\n function getPosition() {\r\n return JSON.parse(atob(\'$position\'));\r\n }\r\n \r\n function getTeam() {\r\n return JSON.parse(atob(\'$team\'));\r\n }\r\n\r\n function getDepartment() {\r\n return JSON.parse(atob(\'$department\'));\r\n }\r\n \r\n function getLanguage() {\r\n return JSON.parse(atob(\'$language\'));\r\n }\r\n\r\n function getAccessLevel() {\r\n return JSON.parse(atob(\'$accessLevel\'));\r\n }\r\n \r\n\";\r\n\r\nnuAddJavascript($js . $j);', NULL, NULL, '1', '0', NULL)
Re: Error when using lookup in a subform
Posted: Mon Jun 13, 2022 2:07 pm
by gerese
Thanks.
Seems to be working fine now
