Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Cloning a form
Cloning a form
I have a form, which is very extensive and has about 60 fields. Now I want to duplicate it so that I don't have to recreate all the fields again. "Clone" unfortunately only copied the form but not the individual fields or the layout. Did I overlook anything?
Last edited by Timo on Wed Mar 28, 2018 4:49 am, edited 1 time in total.
Re: Cloning a from
Timo,
Cloning a Form won't clone its Objects.
You can redirect a Browse Form to whatever Edit Form you like - so in most cases, you don't have to create (and maintain) duplicate Edit Forms.
Steven
Cloning a Form won't clone its Objects.
You can redirect a Browse Form to whatever Edit Form you like - so in most cases, you don't have to create (and maintain) duplicate Edit Forms.
Steven
You do not have the required permissions to view the files attached to this post.
Re: Cloning a form
Well, in my case, it's not an exact duplicate. The underlying table is going to be another one and other fields are added or removed. Are there any other possibilities?
Last edited by Timo on Wed Mar 28, 2018 4:50 am, edited 1 time in total.
Re: Cloning a form
I found out that the objects are stored in a table zzzzsys_object. Can't you just duplicate the rows of the fields you'd like to clone and change a few fields like ids? Would that be reasonable?
Re: Cloning a form
All right, I was able to copy the objects with 1 sql statement. Then I only had to add a few minor settings which were not copied.
Maybe such a function could be integrated into nuBuilder?
Maybe such a function could be integrated into nuBuilder?
Code: Select all
INSERT INTO `zzzzsys_object`(`zzzzsys_object_id`, `sob_all_zzzzsys_form_id`,
`sob_all_table`, `sob_all_type`, `sob_all_id`, `sob_all_label`, `sob_all_zzzzsys_tab_id`,
`sob_all_order`, `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_calc_formula`, `sob_calc_format`, `sob_run_zzzzsys_form_id`, `sob_run_filter`,
`sob_run_method`, `sob_run_id`, `sob_display_sql`, `sob_select_multiple`, `sob_select_sql`,
`sob_lookup_code`, `sob_lookup_description`, `sob_lookup_description_width`, `sob_lookup_autocomplete`,
`sob_lookup_zzzzsys_form_id`, `sob_lookup_javascript`, `sob_lookup_php`, `sob_lookup_table`,
`sob_subform_zzzzsys_form_id`, `sob_subform_foreign_key`, `sob_subform_add`, `sob_subform_delete`,
`sob_subform_type`, `sob_subform_table`, `sob_input_count`, `sob_input_format`, `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_image_zzzzsys_file_id`)
SELECT LEFT(MD5(UUID()),15) as zzzzsys_object_id, ---generate a new id /maybe not the best way but it worked for me.
'7ab3b20fcc1d30e' as sob_all_zzzzsys_form_id, -- new form id
replace(`sob_all_table`,'table1','table2') as sob_all_table, -- in my case, the tables have different prefixes, replace
`sob_all_type`,
replace(`sob_all_id`,'table1','table2'), -- in my case, the ids have different prefixes, replace
`sob_all_label`,
'5ab9c10b3c20d1c' as sob_all_id, -- new tab id
`sob_all_order`,
`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_calc_formula`,
`sob_calc_format`,
`sob_run_zzzzsys_form_id`,
`sob_run_filter`,
`sob_run_method`,
`sob_run_id`,
`sob_display_sql`,
`sob_select_multiple`,
`sob_select_sql`,
`sob_lookup_code`,
`sob_lookup_description`,
`sob_lookup_description_width`,
`sob_lookup_autocomplete`,
`sob_lookup_zzzzsys_form_id`,
`sob_lookup_javascript`,
`sob_lookup_php`,
`sob_lookup_table`,
`sob_subform_zzzzsys_form_id`,
`sob_subform_foreign_key`,
`sob_subform_add`,
`sob_subform_delete`,
`sob_subform_type`,
`sob_subform_table`,
`sob_input_count`,
`sob_input_format`,
`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_image_zzzzsys_file_id`
FROM `zzzzsys_object`
WHERE sob_all_zzzzsys_form_id = '5ac3a290a31510c' -- old form id