June 2, 20169 yr I elaborated a bit on this technique, more specifically the showing/hiding of things in portal rows based on conditionals. I wanted to show or hide a "delete portal row" button in a QUE_ANS portal on a QUE layout using this conditional statement PatternCount ( QUE::Emps ; QUE_ANS::_Emp_IDfk ) > 0 QUE::Emps is a multi-line field holding Employee IDs. QUE_ANS is a portal on the QUE layout, based on QUE::__Question_IDpk = ANS::_Question_IDfk. QUE_ANS::_Emp_IDfk is a single-line field holding an Employee ID. My challenge is to SHOW the "delete portal row" button on a row in the QUE_ANS portal in case the QUE::Emps does NOT contain the QUE_ANS::_Emp_IDfk value. I soon found out that PatternCount has its flaws: the conditional statement above will evaluate as TRUE if QUE::Emps holds for example "99" and QUE_ANS::Emp_IDfk is "199", even if those values are not equal. There seems to be no xCount function for an EXACT match of numbers (or words). The functions "ValueCount" or "WordCount" are no use, as they take 1 parameter only, they count things, they don't search. The function "Exact" compares ALL of QUE::EMPS with QUE_ANS::Emp_IDfk, not a single line, so no use either. Google to the rescue. I changed my conditional to: PatternCount ( "¶" & QUE::Emps & "¶" ; "¶" & QUE_ANS::_Emp_IDfk & "¶" ) > 0 Pre- and post-pending both base and search string in the PatternCount function with a paragraph character seems to do the trick (as the search string must now be a whole line). Can anyone confirm? Or any better techniques without the use of Custom Functions (no FMP Advanced here)? Edited June 2, 20169 yr by Roeland De Windt
June 2, 20169 yr Author Duh! Changed my conditional to: ValueCount ( FilterValues ( QUE::Emps ; QUE_ANS::_Emp_IDfk ) ) Seems to work! No pre- or post-pending needed. A lot cleaner. Thanks again, comments
Create an account or sign in to comment