Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

  • Newbies
Posted (edited)

Hello! I need help with a script with looping to evaluate and mark records. I have four fields: Name_Global, NameA, NameB and Tag. I want to have a result in a field: Tag that is true when either NameA or NameB is a match with Name_Global, but not when that same condition is in the following record(s).

The first record does not need to be evaluated.

Scenario: If the match is true for NameA, for example, in records 1 through 5, then no true result is needed. Records 6 through 10 is a match for NameB, so then record 6 Tag is true, but not records 7 to 10. Carrying on, records 11 through 15 is again a match with NameA so the Tag for record 11 is true, but not the remaining records 12 through 15.

So, in other words, every time the match shows up in the OTHER field in the next record, then the tag is true. The first record that is a match in either NameA to NameB, gets a Tag a true, but not the following ones.

I'm not sure if it matters or not, but please note that when a record is a match for, say, NameA, then NameB will have all kinds of other names that are not to be considered. The only name that needs to be used for evaluating is the one that is entered in Name_Global.

If anyone could write a script for this, I would very much appreciate it. It seems my sense of logic is fading with age???  :(

Edited by Calvin Tomm
Posted

I am having trouble following the logic you describe. It seems you want to mark the first record in a consecutive group of records that have a match (in either field?). If so, it should be possible to loop over the records and do something like:

  • if a match is found and $match is false, mark the record and set $match to true;
  • if no match is found, set $match to false;

As an aside, it seems like there should be a simpler way to accomplish whatever this is supposed to accomplish - but you did not tell us anything about that.

 

 

  • Newbies
Posted

If NameA or NameB matches Name_Global, set Tag to true and set a variable e.g. $LastMatch to Name_Global.

Go to next record.  If NameA or NameB matches $LastMatch go to previous record and set Tag to false, then return to next record.

Clear $LastMatch then loop through the above steps until you get to the end of the set.

Would that work?

If you expect the majority of cases to be false you might want to do this the other way round, i.e. leave Tag as false and go back to it if you need to set it as true, to reduce the number of times you have to move between records.

Not sure if it matters whether the match is with A or B, if it does you could have two variables, one storing the name and the other storing whether it was A or B.

Posted

I think using a real life, concrete example, even if you have to mock it up in Word or a Spreadsheet, and the desired result, may be more helpful (and quicker) to get you to a solution.

This topic is 1141 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
×
×
  • Create New...

Important Information

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