Newbies julie.444 Posted March 27, 2015 Newbies Posted March 27, 2015 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?
comment Posted March 27, 2015 Posted March 27, 2015 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? 1
LaRetta Posted March 27, 2015 Posted March 27, 2015 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.
comment Posted March 27, 2015 Posted March 27, 2015 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
Recommended Posts
This topic is 3586 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 accountSign in
Already have an account? Sign in here.
Sign In Now