Welcome to the nuBuilder Forums!

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

Cloning a form

Questions related to using nuBuilder Forte.
Post Reply
Timo
Posts: 217
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Cloning a form

Unread post by Timo »

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.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Cloning a from

Unread post by admin »

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.
redirect2.PNG
Steven
You do not have the required permissions to view the files attached to this post.
Timo
Posts: 217
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Re: Cloning a form

Unread post by Timo »

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.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Cloning a from

Unread post by admin »

Timo,

You'll need to create it again yourself.

Steven
Timo
Posts: 217
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Re: Cloning a form

Unread post by Timo »

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?
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Cloning a form

Unread post by admin »

Timo,

You could try that.

Steven
Timo
Posts: 217
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Re: Cloning a form

Unread post by Timo »

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?

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
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Cloning a form

Unread post by admin »

Timo,

It might be sometime.

Steven
Post Reply