Jump to content

deleteing obsolete records


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

Recommended Posts

Hi all

Our sales people send us a monthly report and we download it into FM6. Each record has a serial number. We would like to script the deletion of obsolete record if possible. We perform this step manually now. We compare the serial number sent in by the sales people with the db and delete the record in the db that are no longer listed on the sales report. The problem is that the report may contain new information that we would need to keep.

Example:

in the the db the serial numbers are as:

601

602

603

604

605

in the report from the sales people, the serial numbers are as:

602

603

604

605

606

We would like to delete record 601 and keep 606.

Is there a way of doing this with a script.

Thanks in advance

Lionel

Link to comment
Share on other sites

Set up a relationship between the DB and the downloaded report (Serial::Serial).

Loop through the DB and determine if the relationship is Valid. If not, Delete the record.

ShowAll

GotoRecord Request First

Loop

If(Serial = relatedSerial)

Else

DeleteRecordRequest(NoDialog)

EndIf

GoTo Record Request Next (Exit after Last)

EndLoop

ExitScript

There are more elegant solutions, but this should be suffice for your needs.

Enjoy

Link to comment
Share on other sites

My script determines the following...

If the relationship is valid (i.e. the record still exists in the sales report), do nothing.

If the relationship is no longer valid (i.e. the record no longer exists in the sales report), delete the record.

I hope this clarifys things for you.

Link to comment
Share on other sites

Nice Catch...

Revised...

ShowAll

GotoRecord Request First

Loop

If(Serial = relatedSerial)

OmitRecord

Else

DeleteRecordRequest(NoDialog)

EndIf

ExitLoopIf(FoundCount = 0)

EndLoop

ShowAllRecords

ExitScript

Thanks Kidd

Link to comment
Share on other sites

i think there is a MUCH easier way to do that:

import record with "Update Matching Records" + "Add remaining records"

obsolete records will not be in the found set after the import so

Show Omitted

Delete All Records

---

Paolo

Link to comment
Share on other sites

Paolo said:

i think there is a MUCH easier way to do that:

import record with "Update Matching Records" + "Add remaining records"

obsolete records will not be in the found set after the import so

Show Omitted

Delete All Records

Ack, I wouldn't do that! (Delete the records; I WOULD use import/update matching).

You seem to be assuming that there is only one sales person, only one set of records, all historical records are invalid, etc. Doen't seem likely to me.

Link to comment
Share on other sites

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