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.

I'm Almost There...

Featured Replies

Thanks for the prompt reply, BobWeaver. But I have set it up like this, and it will still not work correctly. It will omit the records as desired by the if functions, so that part works fine i think. But, it will only set the fields properly on the FIRST record.

Specifically, heres the results I get:

Records are omitted as desired. Out of a set of 5 records, three meet the criteria. The FIRST record in the filtered set will have the text and date desired in the correct fields, as instructed by the If functions. The remaining two records do not have the text or date entered, as if the Set Field and Current Date functions did not work. How should I fix this?

I hope this makes sense. Thanks again for all your help!!

  • Author

Oh, by the way:

The first record in the set is configured so that it meet the criteria of the 2nd If function (If [status(CurrentDate) >= Letters P Date1 + 4) and (Campaign4= "Auto") and (Letters1.2 = "Intro") and (IsEmpty(Letters1.2))

Set Field ["Letters1.2",""1st FollowUp""]

Insert Current Date [select, "Letters P Date1.2"]) and that is the record that seems to have the info entered properly. Makes a difference or no??

What's wrong with this picture:

(Letters1.2 = "Intro") and (IsEmpty(Letters1.2))

laugh.gif" border="0

  • Author

Sorry, its suppose to read (Letters 1.1 = "Intro") and (IsEmpty(Letters1.2). I went back into the actual script to correct it, but I had just written it wrong in the post. Sorry.

Oh yeah, there's an omit step in there, isn't there. The problem is that after you omit a record it automatically goes to the next one, so the go to next record step will cause you to skip a record in that situation. So, you have to do this:

code:


Go to Record/Request [first] <----Here

Loop

If [status(CurrentDate) >= Letters P Date1 + 4) and (Campaign1 = "Auto") and (Letters1 = "Intro") and (IsEmpty(Letters2))

Set Field ["Letters2",""1st FollowUp""]

Insert Current Date [select, "Letters P Date 1.2"]

Go to Record/Request [exit after last][next] <----Here

Else

If [status(CurrentDate) >= Letters P Date1 + 4) and (Campaign4= "Auto") and (Letters1.1 = "Intro") and (IsEmpty(Letters1.2))

Set Field ["Letters1.2",""1st FollowUp""]

Insert Current Date [select, "Letters P Date1.2"]

Go to Record/Request [exit after last][next] <----Here

Else

If [status(CurrentRecordNumber)=Status(CurrentFoundCount)]

Omit Record

Exit Loop If [1]

Else

Omit Record

End If

End If

End If

End Loop

Go to Layout ["1st Follow Up Letter- Auto"]

Page Setup

etc.....


The Omit step makes things kinda messy, but it should be possible to rearrange the loop structure a bit to clean it up.

  • Author

Thank God! It works!! You don't know how happy I am. I must say, I don't quite understand how that works, so if you find time, could you please explain this step and under what conditions you need them??

Else

If [status(CurrentRecordNumber)=Status(CurrentFoundCount)]

Omit Record

Exit Loop If [1]

Else

Omit Record

I thank you sincerely for helping me with this project. With your help, I have been able to overcome these big obstacles. Thanks.

When you execute a script where you are looping through records, normally you would put a "go to record/request[next][exit after last]" just before the "end loop" step. That way after you've gone through the loop once, it goes to the next record and repeats until you have processed all records. That doesn't work when you have an omit step in the script, because Filemaker automatically jumps to the next record after the omit step. Then the "go to next" step will effectively skip that record, and it won't get processed.

The exception is when the omitted record is the last one. In that case, Filemaker jumps back to the previous record which is now the new last record.

That snippet of code checks if you are on the last record before omitting the record. If not, it omits the record and carries on with the loop. If it is the last record, then it omits the record and then exits the loop ("exit loop if[1]" will always exit). Without, that code, the loop could get stuck omitting the last record in the found set until there are no records left.

  • Author

Ok. I'm sure youre all familiar with this script im writing by now. Rigsby told me that I need to put the Go to Record/Request/Page Next, exit after last at the end of my If function, before the Else Omit Record. But now that I have more conditions in my script, I don't know where to put it. Here is how it looks now:

Loop

If [status(CurrentDate) >= Letters P Date1 + 4) and (Campaign1 = "Auto") and (Letters1 = "Intro") and (IsEmpty(Letters2))

Set Field ["Letters2",""1st FollowUp""]

Insert Current Date [select, "Letters P Date 1.2"]

Else

If [status(CurrentDate) >= Letters P Date1 + 4) and (Campaign4= "Auto") and (Letters1.2 = "Intro") and (IsEmpty(Letters1.2))

Set Field ["Letters1.2",""1st FollowUp""]

Insert Current Date [select, "Letters P Date1.2"]

Else

Omit Record

End If

End If

End Loop

Go to Layout ["1st Follow Up Letter- Auto"]

Page Setup

-this is where I think I want to print-

So, when I run this script (and Ive tried to put the Go to Record/Request/Page in different spots) it seems to either NOT omit the desired records, or it will NOT Set Fields properly (it may only set field correctly in the first record).

My question is, where should I put the Go to Record/Request/Page [Next, exit after last] command in this script with more than one If?

Thanks for your help!!

code:


Go to Record/Request [first] <----Here

Loop

If [status(CurrentDate) >= Letters P Date1 + 4) and (Campaign1 = "Auto") and (Letters1 = "Intro") and (IsEmpty(Letters2))

Set Field ["Letters2",""1st FollowUp""]

Insert Current Date [select, "Letters P Date 1.2"]

Else

If [status(CurrentDate) >= Letters P Date1 + 4) and (Campaign4= "Auto") and (Letters1.2 = "Intro") and (IsEmpty(Letters1.2))

Set Field ["Letters1.2",""1st FollowUp""]

Insert Current Date [select, "Letters P Date1.2"]

Else

Omit Record

End If

End If

Go to Record/Request [exit after last][next] <----Here

End Loop

Go to Layout ["1st Follow Up Letter- Auto"]

Page Setup

etc.....


  • Author

Ok, that makes sense. Another question: When I put in the Exit Loop If [1} step, it appeared like this:

Exit Loop If ["1"]. Will it work properly if the 1 is in quotes, or will it not work?

Thanks for your help.

"1" -- one in quotes -- is text. One by itself is a number. The function is looking for boolean number 1 so a naked 1 might be more correct. It works for me.

Ignor how it displays in the script list, it's what's in the "specify" window that counts.

  • Author

When I entered just the number 1 in the Specify Calculation, it put the quotes there automatically. In Specify Calculation, there are no quotes, but when looking at the entire script, there the quotes are. Is there a way to get rid of them??

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.