I don't think there is supposed to be a limit. That said, I believe I've run into expression length limits before when specifically trying to test that. When long enough, I've had valid expressions crash out the entire application.
Unfortunately, I don't know of a good workaround for what you seem to be trying to do.
Maybe if you need this in a chart type that allows hidden expressions, you could check for a limited number of metrics in several different pick(match()) expressions. Then create a final expression that picks the first non-null value from the previous results. That's assuming the limit is related to one expression or variable, and not to the total across several. Since the limit is likely a bug, it's very hard to guess what might and might not work.
we are having the same problem with Qlikview 10 SR3.
We have some very long formulas in a dozen of variables. One table incorporates all the calculations, so the table expression has a number of IFs that decide which variable to display.
At a certain point the table stops evaluating the variables.
We consider this a bug since there are no explicit indications by Qliktech about the variable length limit.
This is a rather old topic, but I suspect you can autocomment expressions by adding variables.
First set variable, name it vCommentEnabled and set definition to:
Then add a text object to the sheet with expression:
='test 1 ' & $(=$(vCommentEnabled(0))) 'test2'
And add another text object to the sheet with expression:
='test 1 ' & $(=$(vCommentEnabled(1))) 'test2'
You'll notice that based on the parameter 1/0 the latter of the expression is automatically commented out. That is, the 'test2' bit of the expression can be dynamically commented, depending on the output of the variable vCommentEnabled acting as a user defined function.