GetFieldName expects the fields internal ID as its parameter. Your expression does not return that value.
I would use get ( activeFieldContents )
Also note that if the field had two returns but with one or more other characters between them, your use of patterncount will return zero.
I see what you did there. By using get (activeFieldContents) I'm checking for my two carriage returns by searching the actual text instead of trying to refer to a field name.
I did discover on my own that by removing the GetFieldName function from the code...
PatternCount ( Evaluate(Get(ActiveFieldName)) ; "¶¶" )
... it works great.
Correct me if I'm wrong, but I think my error was using the GetFieldName function in the first place, because it turns what was Evaluated back into text, which then PatternCount cannot evaluate properly. By using just Evaluate around Get(ActiveFieldName), I'm doing what you say above, i.e. converting the text into the internal field ID. Do I understand this correctly? If so, I think I finally grok the Evaluate function fully for the first time.
1 of 1 people found this helpful
If you use Get(ActiveFieldName), there is no advantage than get ( activeFieldContents ) that phil mentioned.
If you try to get field contents from various field names without activating the field, you need Evaluate() like
Functions and field references are always evaluated when used inside a calculation. Evaluate is a function that will evaluate the text supplied as parameter as if it was a function, formula or field reference.
Think about out it as you have a text field where you type the formula: 1 + 1. Referencing the field in any calculation would return the text 1+1 into your calculation but if you would use Evalute ( table::textfield ) it would evaluate the formula before evaluating the rest of the calculation.
Say would like to add 2 to the result of formula in your text field:
table::field + 2 would return 13
Evaluate ( table::field ) + 2 would return 4
In this case FM will take only the numbers in your text field '11' and add 2 which makes 13 but in other scenarios you will likely get a more unexpected result or ?.