OpenGround Professional - Trim Function Limitations

This is a public service annoucement describing a bug / limitation of the trim function for OpenGround Professional header calculations.
@Bentley these types of limitations should be included in the OpenGround Wiki as they are a huge waste of time to debug. 

---------------------------

Summary 

The trim() function function does not always function properly when nested within other functions. If you go to Field Geological Details / StratumDetails group, within the Description header calculation, you'll notice that the trim function is nested within several if statements and concatenatewith functions, and then finally nested in a seemingly unnecessary if statement, see below.

if(isblank([StratumDetails.Color]),'' , trim([StratumDetails.Color]))

There is no reason for this if statement, because if [StratumDetails.Color] is empty, there would be nothing to trim and therefore trim([StratumDetails.Color]) would suffice. I suspect that the trim function attempts to trim empty values and creates the following error in the header calculation. 

---------------------------

Detailed Testing

This expression results in the error

This expression does not result in the error

I have tested this with multiple other formulas and the results are the same. 

PS: There is a character maximum on header calculation expressions. It's about 4,000 characters. This is not that hard to hit when writing a Description expression. You may need to create other headers to break up the expression into parts. 

Cheers,