Skip 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.

Bypass find error

Featured Replies

Hi All,

I have a script that finds records for a particular week eg Term 2 Week 1. Terms and Weeks are global fields that another field (A) uses to work out which week of the year that refers to. I have another field (??? that works out what week of the year the current record is in. By going to the All Fields layout, copying the reference from (A), going to find mode and pasting the data in (:, the script finds all the records created that week. Problem is if there are no records I get the 'No Records Match' dialogue. If the user hits cancel, they are taken back to All Fields. Is there any way to bypass this and maybe go to an error page, as I do if it's a web layout? This would allow me to keep it a button type interface.

As a bit of a PS, I came across some posts or tips on modifying one value list with another but now can't find them. Pointers?

Thanks

David crazy.gifcrazy.gif

Hi David, piece of cake. Make the first step of your script:

----------

Set Error Capture (Off)

----------

Then right after you execute your find, insert the steps:

----------

If ( Status ( CurrentFoundCount ) = 0 )

Go to Layout ( "Error Layout" )

Else

Go to Layout ( "Display Layout" )

End If

----------

On the second question: Please explain a little more. What exactly do you mean by "modifying one value list with another?" Example?

HTH

Jerry

locator8 said:

I have a script that finds records for a particular week

--snip--

By going to the All Fields layout, copying the reference from (A), going to find mode and pasting the data in (:, the script finds all the records created that week.

I'm a little confused as to what you are wanting to do, but I would recommend that you change the copy / paste steps to the SetField Script Step. You will find that it eliminates a lot of problems, if doesn't require the movement to the different layouts, and it doesn't require the fields to be on the current layout.

QuinTech said:

Hi David, piece of cake. Make the first step of your script:

----------

Set Error Capture (Off)

----------

Should be Set Error Capture (ON)

QuinTech said:

Then right after you execute your find, insert the steps:

----------

If ( Status ( CurrentFoundCount ) = 0 )

If you use "Status(CurrentFoundCount) = 0", it will dump you on to the layout that you were on before performing the find (i.e. "Display Layout"), with a Found Record Count = 0, and the Go to Layout "Error Layout" will not take place.

However, if you use "Status(CurrentFoundCount) = 401", which is the actual error code for the "No Records Found" error, then your next step of going to the "Error Layout" will take place.

HTH

Lee

cool.gif

Hi Lee, thanks for the catch on the Error Capture step. However, the script will work otherwise. Status ( CurrentFoundCount ) returns 0 if no records are found; Status ( CurrentError ) returns 401 if no records are found. See the attached.

J

smile.gif

Example.zip

You are correct,

My eyes were reading your Status(CurrentFoundCount), as Status(Current Error).

blush.gif

However, it is my understanding that the Status(CurrentFoundCount) wouldn't be necessary here, if you are trapping for the actual error.

Lee

  • Author

To Quintech and Lee

Thanks for the help. I have been implementing the suggestions.

As to the second part, (On the second question: Please explain a little more. What exactly do you mean by "modifying one value list with another?" Example?) There are 4 Terms per year but each Term varies in length. The "Weeks" value list is a series of numbers from 1 to 12. If "Term"=1 and "Weeks"=12 it is possible that it will resolve to the same "Week of the Year" value as "Terms"=2 and "Weeks"=1. I thought a solution might be to have the pop-up field "Terms" modify the values available in "Weeks". Hope that is clearer.

Again, thanks for the help.

David

  • Author

Lee and QuinTech,

I have tried to use the Set Field step, indeed I tried it originally, but can't get it to work. The script looks like this:

---------------

Set Error Capture (On)

Enter Find Mode

Set Field ["Weeks by Number","Weeks Concat"]

If [status(Current Found Count) = 0]

Go to Layout [Error Layout]

Else

Go to Layout {"Specific Week"

End If

Perform Find[Replace Found Set]

---------------------------

"Weeks by Number" is a calc field uses "WeekofYear(Date). "Weeks Concat" is a calc field that work out eg Term2 Week4 = Week of year 20. If I pause the script after the setfield step, "Weeks by Number" is empty, which is why I used the copy/paste steps. As you can probably see, I don't really know what I am doing - just a teacher frittering away my weekends on work we can't afford to outsource.

With this script:

-------------------

Set Error Capture (On)

Go to Layout ["All Fields"]

Show All Records

Copy [select, "Weeks Concat"]

Enter Find Mode

If [status(Current Found Count) = 0]

Go to Layout [Error Layout]

Else

Go to Layout ["Specific Week"]

End If

Paste [select, "Weeks by Number"]

Perform Find [Replace Found Set]

-----------------------

The find works but it doesn't resolve to the error page when no records are found. At least it brings up the layout "Specific Week" with no records which is a step ahead of where I was without your help.

Thanks again.

David

In the first example, move the Perform Find [] to just above the If [ Status(CurrentFoundCount) = 0 ].

Calculation results most likely won't exist in Find Mode. You would need to copy them to a global field before entering Find Mode, then Set Field [whateverfield, globalfield] before Perform Find.

In your second script, you're not performing the find until the very last step. You want to move that just prior to the If [ Status(CurrentFoundCount) = 0 ] step, and the Paste step just prior to that. Otherwise you're not specifying anything to find.

  • Author

Again, thanks to everyone for the help.

David

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.