March 27, 201510 yr Newbies I have 4 fields called sibling 1, 2, 3, 4 that contains different languages. I want to create a 5th field to evaluate the 4 language fields and to say "Yes" or "True" they are all the same language, or to say "No" "False" they are not all the same language. An "IF" calculation works for comparing 2 fields but I can't get it to work for 4 fields. Any ideas?
March 27, 201510 yr This could be done by = Let ( allLangs = List ( Lang1 ; Lang2 ; Lang3 ; Lang4 ) ; ValueCount ( FilterValues ( allLangs ; Lang1 ) ) = 4 ) This will return 1 (True) if all the LangX fields contain the same value, 0 (False) otherwise. If all four fields are empty, the result will be False, too. That said, having numbered ("sibling") fields is usually a symptom of inadequate structure. Why aren't you using related records instead?
March 27, 201510 yr Hi Julie, welcome to FMForums! :-) Follow Comment's direction here ... As an aside for future reference, an If() function only allows two possible values - read up in FM Help about it. If you want similar calculation which allows more than two values, read up on Case() function.
March 27, 201510 yr An "IF" calculation works for comparing 2 fields but I can't get it to work for 4 fields. an If() function only allows two possible values I believe there are only two possible values here as the result - either true or false. The problem is not with the If() function itself. It's the = operator that will only compare two values at a time. But you could still use the If() function and test for = Lang1 = Lang2 and Lang2 = Lang3 and Lang3 = Lang4
Create an account or sign in to comment