13 Replies Latest reply: Oct 18, 2018 9:46 AM by Tamara Witzgall RSS

    Dollar sign expansion not working as expected

    Oliver Franz

      Hi,

       

      I am having some trouble understanding the dollar sign expansion.

       

      Variable Definition of vTest

      5
      
      //test
      
      
      
      
      
      

      The comment in the last line is intended and part of my confusion.


      Scenario 1

      Expression: $(vTest)

      Result: 5

      Internal: I guess that QS expands this to the following and evaluates the complete expression afterwards:

      5
      
      //test
      
      
      
      
      
      


      Scenario 2

      Expression: $(vTest) / 2

      Result: 5

      Internal: I guess that QS expands this to the following and evaluates the complete expression afterwards:

      5
      
      //test / 2
      
      
      
      
      
      


      Scenario 3

      Expression:

      $(vTest)
      / 2
      
      
      
      
      
      

      Result: 2.5

      Internal: I guess that QS expands this to the following and evaluates the complete expression afterwards:

      5
      
      //test
      / 2
      
      
      
      
      
      
      

       

      Scenario 4 - This is what confuses me

      Expression: $(=vTest) / 2

      Result: 5

      Internal: I have no idea what happens here internally. According to the Qlik documentation the equal sign should cause Qlik to pre-evaluate the variable and use the result for the expression.

      The expression will be evaluated and the value will be used in the expansion.

      So what I would have expected is, that Qlik evaluates $(=vTest) to 5 and then divides it by 2, so the result should be 2.5 and not 5.


      Do you have any explanation for what Qlik is doing in my Scenario 4?