Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

  • Author

I should have updated my profile before: I'm using FMP advanced 11.

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

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.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.