Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, everyone!
I have text object with text
=$(vAMTtoCODE('_ins text_'))
And variable vAMTtoCODE with value
'some text ' & $1 &' and so on'
so my text object show that text:
some text _ins text_ and so on
that's ok.
When I try to use in my text object text with comma -
=$(vAMTtoCODE('_ins, text_'))
it fails and show "Error: Garbage after expression: 'on''"!
I try to use that feature of nesting variable to deal with more neat expressions where I want use predefined variables with filters and so on, but there are many commas and it's turned so that I can't write really complicate expression due to that bag.
Is there any workaround? thoughts?
If you want to replace it within the variable you will need another $-sign expansion like:
=$(vAMTtoCODE('$(=Replace('_ins ,text_',',','*')'))) // not tested this yet ... but the direction should be right one
but easier would be to replace only within the target variable and not by the call of the variable.
The reason for this issue is that the parser from the variable couldn't resolve the comma within the variable because it could not differ that the parameter should be only a simple string with commas instead of a parameter-delimiter. But if you replaced the comma with it's ascii-number it worked smoothly, see:
= $(vAMTtoCODE('_ins' & chr(44) & 'text_'))
But I'm not sure if you really need this within a real scenario - I think you could create very complex nested constructions without the mandatory need to pass a comma within a parameter. Maybe you could share such a real case.
- Marcus
Is this input coming from a field? May be try using replace function and then again replace it with comma in your final output?
It seems like good workaround, but unfortunately Qlik has another bug - it just doesn't parse such a expression:
=$(vAMTtoCODE(Replace('_ins ,text_',',','*')))
separate both parts of expression evaluate correctly,
Replace('_ins ,text_', ',' ,'*' )) turns to _ins *text_
and =$(vAMTtoCODE('to _ins *text_') show me
'some text to _ins *text_ and so on'
but when i write =$(vAMTtoCODE(Replace('_ins ,text_', ',' ,'*' )))
it turned to
"Error: Error in expression: ')' expected"
instead of * there can be any symbol.
and - yes, text '_ins ,text_' come from field
If you want to replace it within the variable you will need another $-sign expansion like:
=$(vAMTtoCODE('$(=Replace('_ins ,text_',',','*')'))) // not tested this yet ... but the direction should be right one
but easier would be to replace only within the target variable and not by the call of the variable.
The reason for this issue is that the parser from the variable couldn't resolve the comma within the variable because it could not differ that the parameter should be only a simple string with commas instead of a parameter-delimiter. But if you replaced the comma with it's ascii-number it worked smoothly, see:
= $(vAMTtoCODE('_ins' & chr(44) & 'text_'))
But I'm not sure if you really need this within a real scenario - I think you could create very complex nested constructions without the mandatory need to pass a comma within a parameter. Maybe you could share such a real case.
- Marcus
Marcus, thanks! & chr(44) & - that is what I need