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.

Calc determines if identical data between 6 fields

Featured Replies

I have 6 different fields that ea. will hold a number between 1 and 10. Is there a type of calc that can be used that would look at the six fields, and if any 2 or 3 or 4 fileds have the same matching number, the calc returns a value of "True", otherwise "False."

LR

True if 2, 3, or 4 match, but false if 5, 6, or none match?

What about a full house... or a pair and 4 of a kind? Is that true?

In any case, the answer to the question is "sure, there is an expression".

The question is "how short can that expression be?"

  • Author

LOL. I guess it can all be done with a lot of "if" statements. I mean a lot because I need to generate a true if any of the six fields happen to contain the same number, or better put, if any one number gets used more than once.

LR

Cross-record calculation ?

If not...why not

c_Group = field 1 &"-"& field2 &"-"&field3&"-"&field4&"-"&field5"-"&field6

c_checkValid = Case(Patterncount(c_Group, field1) > 1 or Patterncount(c_Group,field2) >1 or Patterncount(Patterncount; field3) >1 or Patterncount(c_Group, field4) >1 or Patterncount(c_Group, field5) >1 or Patterncount(c_Group, field6) >1,1,0)

There's a slight typo there the 'field3' check.

Since there's only one long condition to check, you may as well use an If() function rather than a Case() function, but that makes little difference.

You could also simplify it slightly by removing the 'field6' check ... if you haven't found any matches up to 'field5', then you can't possibly find one for 'field6', so why bother checking. smile.gif

Yep Harry,

So what about simplifying it a little more

Patterncount(c_Group, field1) > 1 or Patterncount(c_Group,field2) >1 or Patterncount(Patterncount; field3) >1 or Patterncount(c_Group, field4) >1 or Patterncount(c_Group, field5) >1

laugh.gif

Boolean 1,0 no need for If either...

You could do that and it'd work perfectly - it just depends if the original person wants an 'internal' "True" / "False" value for further calculations / scripts or if they want to display "True" / "False" text values on-screen. smile.gif

Edit: On second thoughts, this method won't work if the values can include "10", since the '10' would also get counted as part of the PatternCount() for '1', but isn't a true match for '1'. ooo.gif

The esiest way around this would probably be to have a second set of value fields that convert the originals into hexidecimal values and then use these fields in the c_Group and c_CheckValid calculations.

ie. field 1_hex = If(field 1 = "10", "A", field1)

etc. for all six value fields.

That way "A" won't get included in the PatternCount() for '1'. smile.gif

If you include the separator at the beginning and ending of the c_Group field as well, then you need not worry about 1 being counted in 10. Just use PatternCount(c_Group, "-" & field1 & "-" ) > 1, etc.

That IS easier, but not as much fun as playing with hexidecimal numbers. wink.gif

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.