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.

Patterncount

Featured Replies

I have a script that is looking for a pattern count in a global and if found, will flag that record. It seems to work except for similar records. If the string I am looking for is 1200A and the record contains 1200 it flags it. I don't want it to.

My current script is as follows:

if [ patterncount(global;record)]

Set Field[flag;"Yes"]

meaning if the contents of the record field is in the global field, flag it. But I want it to flag it only if the exact match is found.

How do I do that?

Thanks

Try swapping those parameters:

If [ paterncount( record; global ) ]

The first argument is the text to search and the second is the search string.

  • Author

Sorry, I just typed it wrong in the box here. That is how it is in the script.

Then perhaps you can give an example of the data in the record field and an example of the search text, along with what the result of the patterncount returns. The use of patterncount() implies that there is more than just "1200" in that record field, otherwise you could just use an = to compare them.

  • Author

It is part of a loop. it goes through the records and if the contents of the record field are in the global it flags it. The 1200 is not a static number, it changes from record to record. Each one is checked against the field so where would I put the = ?

If [ record = global ]

If you want a case-sensitive match, use the exact function:

If [ exact(record;global) ]

Alternatively, the Flag could be calculated based on this:

flag (calculation, text result) = case(record=global;"Yes")

Or if the point of setting the Flag was just to mark the records for a subsequent find, it would be better to use a self-join relationship between global and record, and a Go to Related Records[ Show ] script step. This would avoid the whole marking operation all together.

There's many different ways to flag records and change found set, it just depends on what the purpose is.

  • Author

I really appreciate the help Ender!

I don't think the exact function or a self join will work. I have not done a good job explaining my situation so I will try to make more sense.

The global field is a list of model numbers. It has alot of numbers in it. They are separated by a carriage return. some of the numbers have a letter extension, hence the 1200A and the 1200. I want to check each individual record against this list. If the record exists, then everything is ok. If it is not in the list, then I want to add it to the list and set the flag field. So the records Model number won't be an exact match to the global field. The model number is not unique to one record, it can be in many records. As I said before the script I have has worked fine except for the letter extensions. If the first record found is 1200A, then when the record with 1200 is checked, it finds it in the list using the patterncount. If the first record is 1200 then the 1200A won't be found.

Have I confused you yet?

Have I confused you yet?

A long time ago. I have no idea what you're doing or why, sorry.

I would use a self-join. You can match the entire global against the key field with Go To Related Record [show], then Show Omitted (or make the relationship <>). Those are the records that are not in the list. Loop to flag the records, and add each to the original global.

[sorry, didn't see that Ender already suggested this, at the end of his earlier post.]

  • Author

Thanks anyway

If ultimately you want to add all items to the list, why not simply make a value list using values from the field?

In any case, the test you want can be written as:

If [ Position ( ¶ & list & ¶ ; ¶ & item & ¶ ; 1 ; 1 ) ]

If some of the fieldvalues carry a postfix a, shouldn't the fieldtype be number but text ...this might be the source for unreliable selections, but tagging a set of records is also in my book a very unhealthy way to esablish af found set Enders method with a selfjoin is much more healthy.

What it really is, is that you're going to store redundant data, that even have a syncronization problem attached, what happens if the cleaning lady unplugs your machine while at it with the tagging???

Saving searches for future use, is much better achieved this way if the selfjoining makes your stomach turn:

http://www.filemakermagazine.com/modules.php?op=modload&name=News&file=article&sid=544

--sd

  • Author

Thank you so much comment, it worked perfectly.

I realize my logic behind this is not clear but believe me there is a good reason for my madness, I just can't articulate it very well.

Thanks again to all of you for your time and effort, I really do appreciate it!

I agree with Søren, that it's better to avoid flagging and synchronization if possible. Another question is why the model numbers are in a global field? If the Models are in another table there is another way with version 8,* which is to create a relationship on the Model# from one table to the other, and use the "Match all records in current found set" option in the Go To Related Records dialog.

*In version 7 you can do much the same thing by doing an Import, with Update Matching on the key, importing a dummy global (ie., not really importing).

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.