Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5591 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

I am trying to write a script that will duplicate data, but change which book it is for...

Basically, If I have a set of data with the title field: "Book 1" I want to be able to run a script, and have it duplicate the data, though now titled "Book 2" So that both "Book 1" and "Book 2" are in the same table with identical records.

So if I started with 2000 records each with the word "Book 1" in the Title Field... I would now also have 2000 of the same records with "Book 2" in the Title Field.

Edited by Guest
Posted

One method is to add a new field to the table, title_for_export only. On the found set, execute a Replace field contents step and set it to replace with calculated result, = Substitute ( tablename::title_field_containing_book1; "Book1"; "Book2" ), perform with no dialog checked.

Next script step should export the found set; be sure to export title_for_export_only and NOT the title field with book1. Next script step, import the file back in mapping to the 'regular' title. May also want to replace the title with "" to clear it, before the import (just to keep DB file short). Map also any other fields req'd.

An alternate technique that provides more control is to loop through each record; if you do this, may want to use Go to Record by number with Get(Recordnumber) and Get(Foundcount) to keep track of which record you were processing, since creating a new record will move you to it. i.e. end loop when record>Get(Foundcount) recorded before entering loop, and before creating a record, record record number you were on so you can go back to it after creating new record.

This topic is 5591 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.