
1. Re: Problems with GetFieldName function
philmodjunk Feb 16, 2017 5:54 PM (in response to deanchampeau)GetFieldName expects the fields internal ID as its parameter. Your expression does not return that value.
I would use get ( activeFieldContents )
here.
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.

2. Re: Problems with GetFieldName function
deanchampeau Feb 16, 2017 6:07 PM (in response to philmodjunk)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.

3. Re: Problems with GetFieldName function
user19752 Feb 16, 2017 6:43 PM (in response to deanchampeau)1 of 1 people found this helpfulIf 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
Evaluate($fieldName)

4. Re: Problems with GetFieldName function
arjen.evertse Feb 16, 2017 10:01 PM (in response to deanchampeau)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 ?.