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

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

Recommended Posts

Posted

I have a loop that works! (MYFIRST!EVER!) (see screenshot).

What I hope would be possible is to avoid making duplicates. I have a unique control number (AID+CID) for each record of the link table (linking customers (CID), ads (AID) and the issues the ads appear in (IssueID). this table generates printing text as well as billing and payment records. i cannot figure how how to tell FM to skip making a new record if the control number already exists and go on to the next until the loop is exhausted.

the called script copies a customer's ID and the ad ID (from the ad table that already has both numbers) and makes a new link record with the current issueID. The loop script goes through and generates new link record for every found record in the ad table, thus compiling a list of all the ads that should be in the current issue. But if someone accidentally runs that script twice, I get duplicates. Rather than delete duplicates, I'd prefer to avoid making them in the first place.

I can't figure how to script "if this number already exists, skip to the next record until they are done"

Any help appreciated.

post-95582-0-80067900-1325110608_thumb.p

post-95582-0-16965300-1325111161_thumb.p

Posted

So you're in Ads, and it presumably has a relationship by Ad ID to Links.

We can get a list of all issues this ad has been in with a calc:

List( Links::Issue ID )




I would set the current issue ID into a variable at the top of your script so you don't have to go through the Issues relationship to retrieve it for every ad. So let's say that we have that in the variable 
$current_issueID




We can see if the current issue is in the list of related issues like so:



FilterValues( List( Links::Issue ID ); $current_issueID )





Or test that it's NOT in the list like so:


IsEmpty( FilterValues ( List( Links::Issue ID ); $current_issueID ) )




So in your script you can say...


If[ IsEmpty( FilterValues ( List( Links::Issue ID ); $current_issueID ) ) ]

... proceed to create a new link record

End If

  • Newbies
Posted

This looks like it will do the trick, thank you, Fitch. Now I just have to figure out how to insert the if/then into the loop. But that's half the fun of learning this stuff. Happy New Year and I'll be back if I pop a gasket.

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