Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
ashishbhuyekar
Contributor III
Contributor III

Getting error for $ expansion variable check in If block

Hi All,

I have variable vTotalCount which will be assigned through input box. I want to check if variable has value then set to variable value but if varibale doesnot hold value then it should be set to default value to 24.

=IF(len(TRIM(vTotalCount))>0 ,vTotalCount,24)  - This expression working as expected.

But when I use $ expansion , I am getting an error as below-

=IF(len(TRIM($(vTotalCount)))>0 ,vTotalCount,0)

Can someone please help me in this?

1 Solution

Accepted Solutions
sunny_talwar

If it is working without dollar sign expansion, why do you want to use dollar sign expansion?

View solution in original post

3 Replies
sunny_talwar

If it is working without dollar sign expansion, why do you want to use dollar sign expansion?

Peter_Cammaert
Partner - Champion III
Partner - Champion III

That seems very logical to me.

Imagine that vTotalCount either contains an empty string or a string composed of whitespace characters.

Then

  • Trim(vTotalCount) will take an empty or whitespace string from the variable, remove all whitespace characters present and return a blank string in all cases.
  • However, in those same cases Trim($(vTotalCount)) will exapand to either Trim() or Trim( ) without any parameter whatsoever. Which is an illegal function call.

Sunny's question still stands. But if you really want to keep the $-sign expansion, then put the $(...)-expression between single quotes. Trim() only operates on strings anyway...

[Edit] Sorry, kept finding spelling errors...

ashishbhuyekar
Contributor III
Contributor III
Author

Sunny - You are correct, as it is working without $ expansion why to unnecessary complicate. Thanks for replying.