Jump to content
Server Maintenance This Week. ×

Very simple script with a very unexpected result


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

Recommended Posts

Hello all,

I have been pounding my head against a wall that looks like a bug in FM 6.0v4 and I was wondering if any could shed light on the situation. It's a simple situation that has only two possible outcomes but I am getting a third outcome.

Here's the script code that's not working as expected:

Loop

If[ IsEmpty(Related Table::Text1) ]

Delete Record(NoDialog)

Else

Set LocalField1 = Related Table::Text1

End If

Goto Next Record[ Exit after last ]

End Loop

Before the loop, LocalField1 is empty in all records. According to the above code block, after the code finishes, there should be NO records left that have an empty LocalField1. The record should either be wacked or updated with related info. But, after that block of code executes, I still have nearly 350 records that were "missed" by the loop (the script is processing all 8000+ records in the local database). Some of those records do have related data too. I.E. they should have had the related data set to LocalField1 but that aspect isn't working either.

I can't figure it out. According to the code, it's imposslbe for there to be records with a blank LocalField1 field after the script executes.

Can anyone point out the flaw in this reasoning or at least commiserate with me with a "Yeah, that's happened to me too..."?

Thanks all.

Link to comment
Share on other sites

Yeah, that's happened to me too, but it was my fault also.

Your loop skips a record after each deletion. Put your Go to Record/Request/Page [Exit after last, Next] step inside the Else, after the Set Field.

Link to comment
Share on other sites

Queue,

You are my new god. I shall worship you after Beer-thirty each 2nd Tuesday of the month.

That did the trick. Thanks a bunch for saving me from a sleepless night.

Link to comment
Share on other sites

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