Copy/Duplicate button

Dear all,

I need to insert a duplicate record button on a form o in a editable grid.
Does anybody has did it before and is there a complete sample with also php code ?
How can edit it just created and let user to modify some fields ?
I’m not a programmer and I don’t know what to write into php code section.
Many thanks
Giovanni

Re: Copy/Duplicate button

Giovanni,
I am not sure I am interpreting your issue correctly so I think you are looking at this incorrectly but could be wrong.

A grid is usually used to report or access existing records on a database.
A form is used to maintain (add, delete, change) records on a database.

What you might want to do is:

  1. Create a form for table x.
  2. Create a grid for the same table x.
  3. Link the grid to the form using the menu on the left side of the grid application called “Link”. You should use the primary key as the linking field to get to the form.
  4. Execute your form, it should display all the existing records on the database.
  5. Select a record to maintain (change, delete), this will access the form.
  6. If no records exist, you can set the “Link” to display the “New” button when no records exist so that you can get to the form and insert a new record.
    Hope this is correct if not, my apologies.

Re: Copy/Duplicate button

Thanks Javier,

my needing is a little bit different.
Immagine that you have to insert 50 records with more or less the same data except for istance serial number different.
User would like to copy all data from previous record or selected one and then with replicated record available go to edit it and modify only one field content (i.e. serial number).
I need to do that. For istance PHPRunner has it as default icon on each displayed row with the copy icon.
I hope to be more clear
Bye
Giovannino

Re: Copy/Duplicate button

In the grid you can create a button to do that.

Create a run button called (Duplicate for example) … to do waht you want.
http://www.scriptcase.net/phpgenerator/samples/samples.php
Search for “Run Button in a Grid Application (Processing Records)”

Or on the form you can do this onAfterInsert

http://dev.mysql.com/doc/refman/5.0/en/insert-select.html

After insert you can simple execute:

sc_exec_sql(“INSERT INTO TABLE (FIELDS_YOU_WANT) SELECT (FIELDS_YOU_WANT) FROM YOU_PRIMARY_KEY = “. {YOUR_FIELD_PRIMARY_KEY} .””);

Copy button on form

Hello.

Trying to do what you suggest above but can’t get it to work as a form button?

Need a form button that duplicates the current displayed record so the user only has to change a couple of fields instead of retyping everything.

Can someone show what the button code would look like?

Thanks for any help!

Hallo Instore,

Did you try from the toolbar in the form_settings the button “copy”. It should come together with the “update” button.
Watch also “return after inserting” = “yes” in “application/navigation”.
Hope this helps.

Awesome.

Thanks!