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

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

Recommended Posts

Posted

I have a script that imports records for two tables. It goes to a table 1 layout, shows all records, deletes them and then imports records from a FM file. It then goes to table 2, finds all records, deletes them and imports records from another FM file. The problem is that after importing into the table 2 layout it deletes all the records in table 1!!!. I've tried everthing. Is there a problem with doing two imports in one script? Is there a bug, or is my script wrong. As we use to say in the auto business, "sometimes it's the nut that holds the wheel".

Here's the script:

  • # This script imports records from the Accounts Records and Gift Card files located in the parent folder (Gift Card Manager).
  • #
  • Enter Browse Mode
  • Show Custom Dialog [ Title: "Import"; Message: "CAUTION: you are sure you want to import records? Do this for file mainenance purposes and only if you know what you are doing."; Buttons: “OK”, “Cancel” ]
  • If [ Get ( LastMessageChoice )=2 ]
  • Halt Script
  • End If
  • Freeze Window
  • #
  • # Export Accounts table records
  • Go to Layout [ “Export fields-accounts table” (Accounts) ]
  • Show All Records
  • Delete All Records [ No dialog ]
  • Import Records [ Source: “file:Accounts Records.fp7”; Target: “Accounts”; Method: Add; Character Set: “Windows ANSI”; Field Mapping: Source field 1 import to Accounts::pkRecordID Source field 2 import to Accounts::Card Number Source field 3 import to Accounts::Date Source field 4 import to Accounts::ServiceProduct Source field 5 import to Accounts::Price Source field 6 import to Accounts::Deposit ] [ No dialog ]
  • Sort Records [ Specified Sort Order: Accounts::Card Number; ascending ] [ Restore; No dialog ]
  • #
  • # Export GiftCard table records
  • Go to Layout [ “Export fields-GiftCard table” (GiftCard) ]
  • Show All Records
  • Delete All Records [ No dialog ]
  • Import Records [ Source: “file:Gift Card Records.fp7”; Target: “GiftCard”; Method: Add; Character Set: “Windows ANSI”; Field Mapping: Source field 1 import to GiftCard::pkRecordID Source field 2 import to GiftCard::PurchasedBy Source field 3 import to GiftCard::PurchaseDate Source field 4 import to GiftCard::PurchaseAmount Source field 5 import to GiftCard::For Source field 6 import to GiftCard::Card Number Source field 7 import to GiftCard::Notes Source field 8 import to GiftCard::First Name Source field 9 import to GiftCard::Last Name Source field 10 import to GiftCard::Street Source field 11 import to GiftCard::City Source field 12 import to GiftCard::Postal Code Source field 13 import to GiftCard::State Source field 14 import to GiftCard::PhoneHome Source field 15 import to GiftCard::PhoneWork Source field 16 import to GiftCard::PhoneCell Source field 17 import to GiftCard::Date Source field 18 import to GiftCard::Status ] [ No dialog ]
  • Sort Records [ Specified Sort Order: GiftCard::Card Number; ascending ] [ Restore; No dialog ]
  • #
  • Go to Layout [ original layout ]
  • Show Custom Dialog [ Title: "end"; Message: "GiftCard and Account records were sucessfully imported."; Buttons: “OK” ]

Posted

Thanks for your help. You were right. The relationship was set to delete related records. I changed the script and everything is ok now.

This topic is 4709 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.