Welcome to the nuBuilder Forums!

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

Error trying to clone an object

Questions related to using nuBuilder Forte.
n9yty
Posts: 47
Joined: Thu Oct 15, 2020 8:43 pm

Error trying to clone an object

Unread post by n9yty »

I am having a problem with cloning an object on a form. I have tried this with several objects, none clone.

1) I have an object open in the Object editor.
2) I hit the CLONE button
3) The top menu bar changes to just SAVE
4) I change the Label/ID/other information
5) I hit Save
6) It says "Record Saved" briefly, then the window loses all information in all fields and the header just says "Object >"
7) The object is not created

nuDebugLog shows:

[0] :
===USER==========

globeadmin

===PDO MESSAGE===

SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column `nubuilder`.`zzzzsys_object`.`sob_input_count` at row 1

===SQL===========

INSERT INTO zzzzsys_object (zzzzsys_object_id, `sob_all_table`, `sob_all_order`, `sob_all_zzzzsys_tab_id`, `sob_all_type`, `sob_all_label`, `sob_all_id`, `sob_all_top`, `sob_all_left`, `sob_all_width`, `sob_all_height`, `sob_all_cloneable`, `sob_all_align`, `sob_all_validate`, `sob_all_access`, `sob_all_zzzzsys_form_id`, `sob_run_zzzzsys_form_id`, `sob_run_filter`, `sob_run_id`, `sob_run_method`, `sob_display_sql`, `sob_select_sql`, `sob_select_multiple`, `sob_lookup_zzzzsys_form_id`, `sob_lookup_code`, `sob_lookup_table`, `sob_lookup_description`, `sob_lookup_description_width`, `sob_lookup_javascript`, `sob_subform_table`, `sob_subform_zzzzsys_form_id`, `sob_subform_foreign_key`, `sob_subform_add`, `sob_subform_delete`, `sob_subform_type`, `sob_image_zzzzsys_file_id`, `sob_input_format`, `sob_input_count`, `sob_input_type`, `sob_input_javascript`, `sob_html_code`, `sob_html_chart_type`, `sob_html_javascript`, `sob_html_title`, `sob_html_vertical_label`, `sob_html_horizontal_label`, `sob_calc_format`, `sob_calc_formula`) VALUES ('5f8de7ca8aa54fa', 'namf', '110', '5f8be8499ceedb9', 'display', 'Largest Gift Amount', 'big_gift_amount', '4', '200', '100', '20', '1', 'left', '0', '1', '5f8bd480b34bc7d', '', '', '', '', 'SELECT big_gift_amt
FROM prmf
WHERE id_code = #RECORD_ID#', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'D|mm-dd-yyyy', '', 'nuDate', '', '', '', '', '', '', '', '', '');

===BACK TRACE====

/Users/n9yty/Sites/nubuilder/nudata.php - line 386 (nuRunQuery)

/Users/n9yty/Sites/nubuilder/nuapi.php - line 51 (nuUpdateDatabase)
n9yty
Posts: 47
Joined: Thu Oct 15, 2020 8:43 pm

Re: Error trying to clone an object

Unread post by n9yty »

I do see in the zzzzsys_object table that the object I am trying to clone, which was created from the "Form Object List" menu, as were most (all?) the fields on this form, has a NULL in the `sob_input_count` column. Many objects in the table do. But I see the ones created when I was troubleshooting my earlier problem, created using the FastForms Builder, have a 0 in this column. If I modify the table to put a 0 in there for the initial field, the clone works.
n9yty
Posts: 47
Joined: Thu Oct 15, 2020 8:43 pm

Re: Error trying to clone an object

Unread post by n9yty »

I also note that for the objects I created manually have a lot of other columns with NULL that the FastForm objects do not seem to, they are blank, not NULL.

In fact, for the FastForm created objects, I don't see a single column with a NULL value, whereas there are many for the manually created objects.

For the field I just cloned (after changing the sob_input_count on the source object) the only NULL column is sob_lookup_autocomplete, all the other objects either have a value or are simply blank.
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: Error trying to clone an object

Unread post by Janusz »

I also note that for the objects I created manually have a lot of other columns with NULL that the FastForm objects do not seem to, they are blank, not NULL.

In fact, for the FastForm created objects, I don't see a single column with a NULL value, whereas there are many for the manually created objects.
just to confirm I have the same behaviour.
if you want to allow object clone - so after manually created objects you need to change the sob_input_count and sob_all_order to 0.
or best to change default value in the mysql table to 0 using phpmyadmin or with code from below.

Code: Select all

ALTER TABLE `zzzzsys_object` CHANGE `sob_input_count` `sob_input_count` BIGINT(20) NULL DEFAULT '0';
ALTER TABLE `zzzzsys_object` CHANGE `sob_all_order` `sob_all_order` INT(11) NULL DEFAULT '0';
and all objects created after should be cloneable. Dont forget to make a DB back-up before.
If you like nuBuilder, please leave a review on SourceForge
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: Error trying to clone an object

Unread post by kev1n »

I'm not getting any errors when cloning objects here.
All I see in phpMyAdmin, when I run your query manually, a Warning but not an Error.
Warning: #1366 Incorrect integer value: '' for column `nu6`.`zzzzsys_object`.`sob_input_count` at row 1
You guys probably have set sql_mode=strict

Also see this stackoverflow post:
It depends on the sql_mode you're running as. If the mode isn't strict then you'll get the inserted value to be the same as the coercion to that type,
https://dba.stackexchange.com/questions ... d-in-mysql

@Janusz: Nice fix. Should be included in nuBuilder! Added the Bug to my Bugtracker
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: Error trying to clone an object

Unread post by Janusz »

Yes - I am keeping default MariaDB strict mode settings:

Code: Select all

MariaDB [(none)]> SHOW VARIABLES LIKE 'sql_mode';
+---------------+-------------------------------------------------------------------------------------------+
| Variable_name | Value                                                                                     |
+---------------+-------------------------------------------------------------------------------------------+
| sql_mode      | STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+---------------+-------------------------------------------------------------------------------------------+
1 row in set (0.002 sec)
https://stackoverflow.com/questions/384 ... or-mariadb
and like this explanation from above post:
Always use strict mode. That is, until you get fed up with its restrictions. The mode is there to help you, but it may be painful.
If you like nuBuilder, please leave a review on SourceForge
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: Error trying to clone an object

Unread post by Janusz »

Steven,
To summarize above topic - there are some issue to make clone of objects added/created manually. When FastForm is used there is no issue.
I think that quick solution for that can be to add default value equal to 0 for the: sob_input_count & sob_all_order in zzzzsys_object. Because NULL value there is not allowing clone.

Code: Select all

ALTER TABLE `zzzzsys_object` CHANGE `sob_input_count` `sob_input_count` BIGINT(20) NULL DEFAULT '0';
ALTER TABLE `zzzzsys_object` CHANGE `sob_all_order` `sob_all_order` INT(11) NULL DEFAULT '0';
During my test I did not notice any drawback related to that.

Please find enclosed a movie showing the subject (not very short - but wanted to present whole process)
https://drive.google.com/file/d/1xDU3YZ ... sp=sharing
(not to watch the whole movie the key info is at duration 6:30 at the movie)

and some explanation to the movie:
q11_ - added just only to allow quick filterig
...FF... - objects created with FastForm
...M1.. - objects created manually on default setup
...M2.. - objects created manually after changing default value to 0 for sob_input_count & sob_all_order
as result we can see that:
clone is not working for ..M1.. objects
but for ..M2.. is OK

Would it be possible to implement this with next release? - of course if no other drawbacks related to that.

Janusz
If you like nuBuilder, please leave a review on SourceForge
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Error trying to clone an object

Unread post by admin »

Janusz,

I have added your fix to Github.

Thanks.


Steven
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: Error trying to clone an object

Unread post by Janusz »

Steven,
Thanks a lot for implementing this. The Github copy works fine :-)
And one info - I noticed as well the new update on the Sourceforge - but still with previous version of nubuilder4.sql (with DEFAULT NULL for sob_all_order and sob_input_count).

Janusz
If you like nuBuilder, please leave a review on SourceForge
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Error trying to clone an object

Unread post by admin »

Janusz,

I think I've fixed it on Github now.

Please test it.


Steven
Post Reply