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.

Featured Replies

  • Newbies

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

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

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.

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.

Create an account or sign in to comment

Important Information

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

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.