Cloner: Difference between revisions
mNo edit summary |
[Updated] Cloner |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
== Cloner == | |||
The '''Cloner''' feature is a built-in functionality designed to streamline form duplication within nuBuilder. | |||
* [[Media:HomeDatabaseClonerMenu.png|Menu]] | |||
* [[Media:Cloner.png|Screenshot]] | |||
With the Cloner, you can effortlessly duplicate any '''form''' along with its objects, events, subforms, and iframe (run) forms. The Cloner allows duplication in SQL format, making it easy to import forms into any other '''nuBuilder''' installation. Additionally, subforms can be included for a seamless transfer to another database. | |||
== Features == | |||
* Clone an entire form, including its objects, events, subforms, and iframe (run) forms | |||
* Select specific form tabs to include in the duplication | |||
* Copy objects to a new form or merge them into an existing form | |||
* Generate SQL INSERT (or REPLACE INTO) statements, which can either be: | |||
** Previewed in the browser before execution | |||
** Automatically executed by nuBuilder | |||
** Manually run using database tools like phpMyAdmin or Adminer | |||
== Use Cases == | |||
* Clone a form to test modifications before applying them to the live system | |||
* Export a form from one database and import it into another | |||
* Quickly create a similar form without starting from scratch | |||
* Copy a group of controls from one form to another | |||
== Source Form == | |||
'''Source Form''': This is where you select which form in the current database you want to clone. Once chosen, the Cloner gathers all relevant information—such as the form layout, objects, subforms, events, and iframe (run) forms—so that it can generate SQL to replicate them. | |||
* '''Tabs / Subforms / IFrame forms''': Depending on how your original form is set up, these fields let you include additional components in the cloning process. For instance: | |||
** If the source form has tabs, you can decide whether to include them in the clone. | |||
** If the form contains subforms, you can choose to include those as well. | |||
** If the form embeds iframe (run) forms, you can select whether to bring them along. | |||
== Destination Form == | |||
'''Destination Form''': This is where you specify the name of the form that will be created or updated in the destination database. | |||
* If you leave this field blank, a new form will be created with the same name as the source form. | |||
* If you type in a different name, the cloned form will be created under that new name. | |||
== Options == | |||
=== Without Objects === | |||
If you check “Without Objects,” the Cloner will only replicate the form record itself but exclude all form objects (fields, buttons, etc.). | |||
* Use Case: Copy just the bare‐bones form structure (for example, if you plan to add brand‐new objects later). | |||
=== Dump SQL Statements === | |||
When this option is checked, the Cloner outputs the SQL statements directly on‐screen so you can copy/paste them. | |||
* Use Case: Most of the time, you’ll want this enabled to easily transfer or review the SQL before running it in the destination database. | |||
=== Generate new PKs === | |||
This option tells the Cloner to generate new primary key values (IDs) for the cloned form and its objects. | |||
* Checked: Ensures no ID collisions in the destination database or if you don’t care about preserving the same object IDs. This is safer if the destination already has records with those IDs. | |||
* Unchecked: Preserves the exact same IDs—for instance, if you have references to those IDs in custom code or if you’re updating an existing form. | |||
=== REPLACE INTO === | |||
When checked, the Cloner uses '''REPLACE INTO''' statements in the SQL instead of '''INSERT INTO'''. This means that if the form or objects already exist in the destination database (same ID), they will be overwritten or updated. | |||
* Checked: You are updating an existing form or objects in the destination database. | |||
* Unchecked: You are creating new records and do not want to overwrite existing records with the same IDs. | |||
=== Notes === | |||
A simple text field to store any comments or reminders about the cloning process. | |||
== Sample Workflow == | |||
# Open the Cloner in the Source Database | |||
# From the Database dropdown, select '''Cloner'''. | |||
# Configure the Cloner: | |||
#* Click '''Add''' and select your Source Form. | |||
#* Under Options: | |||
#** Untick “Generate new PKs” if you want to keep the exact same IDs. | |||
#** Tick “REPLACE INTO” if you want to overwrite existing forms or objects with the same IDs in the destination database. | |||
# Generate and Copy the SQL: | |||
#* Click '''Run''' to have the Cloner produce the SQL statements. | |||
#* Copy the generated SQL to your clipboard. | |||
#* (Optional) Save your Cloner configuration if you plan to reuse these settings later. | |||
# Execute the SQL in the Destination Database: | |||
#* Open the Destination nuBuilder and go to phpMyAdmin (or your database tool). | |||
#* Paste the SQL statements into the query editor. | |||
#* Click '''Run''' (or “Go”) to execute the statements, which will create/update the form and objects in the destination database. | |||
== Additional Use Cases == | |||
* '''Moving Forms from Development to Production''': Often you’ll design and test forms in a development environment. Once ready, you can clone them into production using “Dump SQL Statements” and “REPLACE INTO” to ensure the production environment is up to date. | |||
* '''Duplicating a Form Within the Same Database''': If you want a similar form with slight modifications—such as different labels or field names—you can use the Cloner to replicate it under a new name. In this case, checking “Generate new PKs” prevents ID conflicts. | |||
* '''Creating a ‘Template’ Form''': Maintain a form in a “template” database. Whenever you need a new project or system, clone that template form into the new environment quickly. | |||
* '''Selective Cloning''': If you only want the layout (tabs, general settings) but plan to create your own objects afterward, clone the form '''Without Objects'''. This helps you skip deleting unwanted fields post‐cloning. |
Latest revision as of 04:51, 3 June 2025
Cloner
The Cloner feature is a built-in functionality designed to streamline form duplication within nuBuilder.
With the Cloner, you can effortlessly duplicate any form along with its objects, events, subforms, and iframe (run) forms. The Cloner allows duplication in SQL format, making it easy to import forms into any other nuBuilder installation. Additionally, subforms can be included for a seamless transfer to another database.
Features
- Clone an entire form, including its objects, events, subforms, and iframe (run) forms
- Select specific form tabs to include in the duplication
- Copy objects to a new form or merge them into an existing form
- Generate SQL INSERT (or REPLACE INTO) statements, which can either be:
- Previewed in the browser before execution
- Automatically executed by nuBuilder
- Manually run using database tools like phpMyAdmin or Adminer
Use Cases
- Clone a form to test modifications before applying them to the live system
- Export a form from one database and import it into another
- Quickly create a similar form without starting from scratch
- Copy a group of controls from one form to another
Source Form
Source Form: This is where you select which form in the current database you want to clone. Once chosen, the Cloner gathers all relevant information—such as the form layout, objects, subforms, events, and iframe (run) forms—so that it can generate SQL to replicate them.
- Tabs / Subforms / IFrame forms: Depending on how your original form is set up, these fields let you include additional components in the cloning process. For instance:
- If the source form has tabs, you can decide whether to include them in the clone.
- If the form contains subforms, you can choose to include those as well.
- If the form embeds iframe (run) forms, you can select whether to bring them along.
Destination Form
Destination Form: This is where you specify the name of the form that will be created or updated in the destination database.
- If you leave this field blank, a new form will be created with the same name as the source form.
- If you type in a different name, the cloned form will be created under that new name.
Options
Without Objects
If you check “Without Objects,” the Cloner will only replicate the form record itself but exclude all form objects (fields, buttons, etc.).
- Use Case: Copy just the bare‐bones form structure (for example, if you plan to add brand‐new objects later).
Dump SQL Statements
When this option is checked, the Cloner outputs the SQL statements directly on‐screen so you can copy/paste them.
- Use Case: Most of the time, you’ll want this enabled to easily transfer or review the SQL before running it in the destination database.
Generate new PKs
This option tells the Cloner to generate new primary key values (IDs) for the cloned form and its objects.
- Checked: Ensures no ID collisions in the destination database or if you don’t care about preserving the same object IDs. This is safer if the destination already has records with those IDs.
- Unchecked: Preserves the exact same IDs—for instance, if you have references to those IDs in custom code or if you’re updating an existing form.
REPLACE INTO
When checked, the Cloner uses REPLACE INTO statements in the SQL instead of INSERT INTO. This means that if the form or objects already exist in the destination database (same ID), they will be overwritten or updated.
- Checked: You are updating an existing form or objects in the destination database.
- Unchecked: You are creating new records and do not want to overwrite existing records with the same IDs.
Notes
A simple text field to store any comments or reminders about the cloning process.
Sample Workflow
- Open the Cloner in the Source Database
- From the Database dropdown, select Cloner.
- Configure the Cloner:
- Click Add and select your Source Form.
- Under Options:
- Untick “Generate new PKs” if you want to keep the exact same IDs.
- Tick “REPLACE INTO” if you want to overwrite existing forms or objects with the same IDs in the destination database.
- Generate and Copy the SQL:
- Click Run to have the Cloner produce the SQL statements.
- Copy the generated SQL to your clipboard.
- (Optional) Save your Cloner configuration if you plan to reuse these settings later.
- Execute the SQL in the Destination Database:
- Open the Destination nuBuilder and go to phpMyAdmin (or your database tool).
- Paste the SQL statements into the query editor.
- Click Run (or “Go”) to execute the statements, which will create/update the form and objects in the destination database.
Additional Use Cases
- Moving Forms from Development to Production: Often you’ll design and test forms in a development environment. Once ready, you can clone them into production using “Dump SQL Statements” and “REPLACE INTO” to ensure the production environment is up to date.
- Duplicating a Form Within the Same Database: If you want a similar form with slight modifications—such as different labels or field names—you can use the Cloner to replicate it under a new name. In this case, checking “Generate new PKs” prevents ID conflicts.
- Creating a ‘Template’ Form: Maintain a form in a “template” database. Whenever you need a new project or system, clone that template form into the new environment quickly.
- Selective Cloning: If you only want the layout (tabs, general settings) but plan to create your own objects afterward, clone the form Without Objects. This helps you skip deleting unwanted fields post‐cloning.