Page 1 of 1
nuGetLookupId PDO Errors on Launch Form
Posted: Fri May 28, 2021 2:53 pm
by vario
I am getting PDO errors when I try to assign a default value to a lookup object on a Launch form. The form is used to supply parameters to a report, and I have nuGetLookupId in a nuOnLoad function for the launch form. The code supplies the default value, but in zzzzsys_debug I get these errors:
Code: Select all
===PDO MESSAGE===
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '
,
FROM zzzzsys_setup
WHERE
`` = '1100DEA59059'' at line 2
===SQL===========
SELECT
,
,
FROM zzzzsys_setup
WHERE
`` = '1100DEA59059'
===BACK TRACE====
/var/www/forte/core/nuform.php - line 631 (nuRunQuery)
/var/www/forte/core/nuform.php - line 592 (nuGetLookupValues)
/var/www/forte/core/nuapi.php - line 61 (nuGetAllLookupValues)
Code: Select all
===PDO MESSAGE===
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE = ''' at line 1
===SQL===========
SELECT * FROM WHERE = ?
===BACK TRACE====
/var/www/forte/core/nuform.php - line 558 (nuRunQuery)
/var/www/forte/core/nuform.php - line 596 (nuGetOtherLookupValues)
/var/www/forte/core/nuapi.php - line 61 (nuGetAllLookupValues)
Is it OK to use nuGetLookupId on a launch form or is there a problem with my code?
Neil.
Re: nuGetLookupId PDO Errors on Launch Form
Posted: Fri May 28, 2021 3:30 pm
by kev1n
It works fine for me.
Can you show your JS code?
And where did you place the code?
Re: nuGetLookupId PDO Errors on Launch Form
Posted: Fri May 28, 2021 5:36 pm
by vario
The code is in the JS for the launch form:
Code: Select all
function nuOnLoad() {
// Assign default values
nuGetLookupId('123XXX123456','ATCOCode');
$('#qry_ord').val('asc');
$('#fromdate').val(new Date().toISOString().slice(0,10));
$('#fromtime').val('06:00');
$('#totime').val('20:00');
$('#radius').val('100');
$('#also_min').val('5');
$('#also_chk').val('0');
$('#hist_chk').val('0');
$('#also_lat').val('0');
}
Just a thought - would it matter that the table is not a "nuBuilder" table i.e the PK is not varchar(25)?
Re: nuGetLookupId PDO Errors on Launch Form
Posted: Fri May 28, 2021 5:55 pm
by kev1n
No error on my side even if the PK is an int(11) with AUTO_INCREMENT.
How to replicate your error? Any change to upload a small sample db?
Re: nuGetLookupId PDO Errors on Launch Form
Posted: Fri May 28, 2021 6:10 pm
by vario
By repeat attempts I have found the error does not always occur. When it does the http error log has the following:
Code: Select all
[Fri May 28 16:54:57.257864 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Undefined array key "object_id" in /var/www/forte/core/nuform.php on line 582, referer: https://...
[Fri May 28 16:54:57.258253 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sob_all_validate" on bool in /var/www/forte/core/nuform.php on line 462, referer: https://...
[Fri May 28 16:54:57.258271 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sob_all_type" on bool in /var/www/forte/core/nuform.php on line 464, referer: https://...
[Fri May 28 16:54:57.258282 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "zzzzsys_object_id" on bool in /var/www/forte/core/nuform.php on line 465, referer: https://...
[Fri May 28 16:54:57.258291 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sob_all_id" on bool in /var/www/forte/core/nuform.php on line 466, referer: https://...
[Fri May 28 16:54:57.258309 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sob_all_label" on bool in /var/www/forte/core/nuform.php on line 467, referer: https://...
[Fri May 28 16:54:57.258328 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sob_all_top" on bool in /var/www/forte/core/nuform.php on line 468, referer: https://...
[Fri May 28 16:54:57.258347 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sob_all_left" on bool in /var/www/forte/core/nuform.php on line 469, referer: https://...
[Fri May 28 16:54:57.258365 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sob_all_width" on bool in /var/www/forte/core/nuform.php on line 470, referer: https://...
[Fri May 28 16:54:57.258383 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sob_all_height" on bool in /var/www/forte/core/nuform.php on line 471, referer: https://...
[Fri May 28 16:54:57.258401 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sob_all_validate" on bool in /var/www/forte/core/nuform.php on line 472, referer: https://...
[Fri May 28 16:54:57.258449 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sob_all_access" on bool in /var/www/forte/core/nuform.php on line 473, referer: https://...
[Fri May 28 16:54:57.258471 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sob_lookup_description_width" on bool in /var/www/forte/core/nuform.php on line 588, referer: https://..
[Fri May 28 16:54:57.258491 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sob_lookup_zzzzsys_form_id" on bool in /var/www/forte/core/nuform.php on line 589, referer: https://..
[Fri May 28 16:54:57.259313 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sfo_browse_sql" on bool in /var/www/forte/core/nuform.php on line 618, referer: https://...
[Fri May 28 16:54:57.259350 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sfo_primary_key" on bool in /var/www/forte/core/nuform.php on line 622, referer: https://...
[Fri May 28 16:54:57.259356 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sob_lookup_code" on bool in /var/www/forte/core/nuform.php on line 623, referer: https://...
[Fri May 28 16:54:57.259361 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sob_lookup_description" on bool in /var/www/forte/core/nuform.php on line 624, referer: https://..
[Fri May 28 16:54:57.259366 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sfo_primary_key" on bool in /var/www/forte/core/nuform.php on line 627, referer: https://...
[Fri May 28 16:54:57.260611 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "form_id" on bool in /var/www/forte/core/nuform.php on line 555, referer: https://...
[Fri May 28 16:54:57.260851 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sfo_table" on bool in /var/www/forte/core/nuform.php on line 557, referer: https://...
[Fri May 28 16:54:57.260879 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sfo_primary_key" on bool in /var/www/forte/core/nuform.php on line 557, referer: https://...
[Fri May 28 16:54:57.261544 2021] [php:warn] [pid 205018] [client 192.168.1.7:49510] PHP Warning: Attempt to read property "sob_lookup_javascript" on bool in /var/www/forte/core/nuform.php on line 600, referer: https://...
So now I have to figure out exactly what sequence of events leads reliably to the error! I am simply clicking a button to run the launch form and then another button on the form to run the report ( via nuRunReport)
Neil.
Re: nuGetLookupId PDO Errors on Launch Form
Posted: Fri May 28, 2021 6:32 pm
by vario
OK, I have a reliable method.
The error (both PDO in zzzzsys_debug & the PHP warnings) happens when leaving the launch form via the breadcrumb. If I log out from the launch form no error.
Also, if I clone the lookup and put it on another launch form, the very same thing happens.
Re: nuGetLookupId PDO Errors on Launch Form
Posted: Fri May 28, 2021 6:43 pm
by kev1n
What if you remove nuOnLoad(). This is not required in a form's custom code.
Re: nuGetLookupId PDO Errors on Launch Form
Posted: Fri May 28, 2021 6:54 pm
by vario
Good one - that has stopped the error! Out of curiosity, when does a form's JS run - is it basically "on load"?
I have used nuOnLoad on a couple of other launch forms without issue, so something about nuGetLookupID doesn't work with it?
Neil.
Re: nuGetLookupId PDO Errors on Launch Form
Posted: Fri May 28, 2021 7:05 pm
by kev1n
The JS runs right a way when the form was created/loaded.
nuOnLoad() is just to be used in the (Setup->)Header.