Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

ashishbhuyekar
New 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

Re: Getting error for $ expansion variable check in If block

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

View solution in original post

3 Replies

Re: Getting error for $ expansion variable check in If block

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

View solution in original post

Re: Getting error for $ expansion variable check in If block

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...

Highlighted
ashishbhuyekar
New Contributor III

Re: Getting error for $ expansion variable check in If block

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