Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Error when using lookup in a subform Topic is solved

Questions related to using nuBuilder Forte.
Post Reply
gerese
Posts: 132
Joined: Sun Dec 16, 2018 6:13 pm
Location: România
Has thanked: 30 times
Been thanked: 4 times

Error when using lookup in a subform

Unread post 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
You do not have the required permissions to view the files attached to this post.
nuBuilderForte .... BIG Like !!!
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Error when using lookup in a subform

Unread post 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.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Error when using lookup in a subform

Unread post 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)
gerese
Posts: 132
Joined: Sun Dec 16, 2018 6:13 pm
Location: România
Has thanked: 30 times
Been thanked: 4 times

Re: Error when using lookup in a subform

Unread post by gerese »

Thanks.
Seems to be working fine now :thumb:
nuBuilderForte .... BIG Like !!!
Post Reply