Jump to content

Patterncount


This topic is 5753 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 = ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This topic is 5753 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

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