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.

Scripted Finds won't work right

Featured Replies

  • Newbies

6 to 7 went pretty good. except 55 searches change the wrong records sometimes. They used to work. These scripts each checks if no records found. simple. But instead they continue sometimes using records from same layout but last find instead. I can posts scripts if necessary. But they all do it and worked in 6. checked windows, layouts, commit records. Last piece to figure out before going live.

Thank you for considering helping.

Edited by Guest

Sure, post a script for us to look at.

  • Author
  • Newbies

Okay, Ender. Kept rebashing this mess. No script is similar enough (opens different windows, GTRR). But their finds are all almost identical to this one.

Set Error Capture [On]

Alow User Abort [Off]

Go to Layout [invoice table]

Enter Find Mode[]

Set Field [ Posted, 0 ]

Perform Find[]

If [ Get Found Count = 0

Go to Layout [ Finish month-end ]

Show All Records

Exit script

End If

Go to Record Request [First ]

Loop

Insert Calculated Result [ Date Posted , global Date]

Go to Record [Next, exit if last]

End Loop

Go to Layout [Finish Month End ]

Show All Records

worked in 6. Now sometimes it goes through the whole darned invoices table rewriting the date posted or whatever. Why would it work sometimes and not others beats me. Not record lock, tested when nobody here. Used these scripts so much. Tried Commit after Set Field. Didn't help. Brain is fried.

now why do i sit here feeling like I'm exposing my underware or something. :blush: nobody seen my code before. LOL

Edited by Guest

Try testing for the 'no records found' error code after the Perform Find:

...

Perform Find[]

If [ Get ( LastError ) = 401 ]

# No records found

Go to Layout [ Finish month-end ]

Show All Records

Exit script

End If

...

P.S.:D Getting other's help with tidying up one's code is a fine way to learn. I think I see a couple optimizations that could be employed in your script above. First, the Insert Calculated Result[] script step could be replaced with a Set Field[]. This would allow the script to run without having the Date Posted field on the layout. Or you might replace the whole loop with a Replace[] script step. I'd also suggest that you add a Commit Record[] step at the end. This would help prevent a record locking issue in a multi-user solution.

Edited by Guest

  • Author
  • Newbies

That worked Ender.:P Ran 5 tests to be sure.

Do you mind me asking why Get Found Count won't work anymore? The conversion changed it from Status(CurrentFoundCount) = 0 to Get. either Error or Found Count 0 should have worked. I swear it's worked for 2 years without a problem.

About the rest? Yeah. I'm hope to replace all my finds with script parimeters and stuff as soon as i know what they are. I will change Insert Calculated too. I don't like Get Found Count anymore. It's unreliable. What was filemaker thinking on that one? Wish they'd kept Status(CurrentFound. That always worked.

Much obliged. :D Can't tell you how much you've helped me.

Edited by Guest

I don't know why this behavior has changed. Get(FoundCount) is equivelant to Status(CurrentFoundCount) in FM6.

Hi Mike and tester123! :D

Here's one possible explanation ...

A new Find behavior in vs. 7 is that, if no records are found, FM will revert back to the prior found set (or all records). I'm not even sure if a Find CAN produce a 0 record count any more! Get(FoundCount), as far as I know, works just as reliably as Status(CurrentFoundCount); it's just that when your find returns no records it may be reverting on you (and might explain why it loop-sets an entire data-group).

Maybe that's why Get(FoundCount) = 0 isn't a good test here and Get(LastError) worked. I don't recall this being discussed in the migration documentation and this is simply speculation but it seems to fit. tester123, if this is the case, I would bet you aren't the only one that has hit this particular snag. :crazy:

Note: I'm not implying you can't have a record-set of 0. You can and I have ... using Omit. But I'm unsure if a FIND can produce 0 records returned. Hmmmm, now I wonder about tests such as If [ not Get(FoundCount)! Interesting if true! But again, I may just be nuts! I'll have to test it.

LaRetta

I have had no problems using If [not Get(FoundCount)]. Have you updated to v3?

Have I upgraded to 7.0v3? What a question, JT!

Ummm, errrr, all systems except my home system. I lost my Developer CD. I'm still on 7.0v1 at home ... where I do all testing ... where I do everything in the universe. Could that throw off my assumptions on this issue? :blush:

Oh this little blushy guy is sure getting a workout today. :D

Okay. Tearing house apart, I'm convinced it's under this 4' stack of papers ... upgrading today. I'll never be caught like THIS again! Who knows how far my mind would have ran on invalid theory.

Well ... I DID say it was speculation ... :jester:

LaRetta

Actually, I was questioning the OP. But I'm glad I caught you off guard and encouraged you to update also. :cool:

  • Author
  • Newbies

OK found a layout change that didn't .. that might explain some too. I'll get back to you all later. This is all good stuff to know or speculate :D

I appreciate it

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.