3 Replies Latest reply: Dec 23, 2017 12:47 PM by Radovan Oresky RSS

    Use of Variable

    Informatica Eurofirms

      Good afternoon!

       

      I had been doing my first steps with Qlik Sense this week but I have a error when I use a variable and I don't understand the reason.

       

      I have these variables:

       

      LET numMutues = Count(nomMutua);

      LET rangs = Floor(255/numMutues);

       

       

      And my Load is here:

       

      MutuesRGB:

      LOAD ApplyMap('mMutues', "ID", 'No informado') as mutua,

      $(rangs) as ValueRanged

      FROM  [$(vPathQVD)Mutues.qvd](qvd);

       

      How Can I use the variable into the "Load"?

       

      Thanks for the help!

        • Re: Use of Variable
          Bill Markham

          What error are you getting ?

           

          From quick look though, it appears you are not using a Qlik Sense data connection in your FROM bit, but using the QlikView explicit path method.

          • Re: Use of Variable
            Marcus Sommer

            None of your displayed variables are used within the load and they won't work in this way either - starting with LET and assigning then an aggregation-function. Here you will find many valuable informations about Variables.

             

            - Marcus

            • Re: Use of Variable
              Radovan Oresky

              Hi,

               

              I guess what you need is to do this:

               

              SET numMutues = 'Count(nomMutua)'; // SET function defines a string which can be used in the script, you must use single quotes in this case.


              SET rangs = 'Floor(255/$(numMutues))'; // dollar sign is needed to exchange the variable name by its content

               

              But you will need to add a GROUP BY statement after FROM in your LOAD script, because you are using the Count() funcion. So something like this:

               

              MutuesRGB:

              LOAD ApplyMap('mMutues', "ID", 'No informado') as mutua,

              $(rangs) as ValueRanged

              FROM  [$(vPathQVD)Mutues.qvd](qvd)

              GROUP BY "ID";


              I do not completely understand what you want to achieve but hope this helps.


              Regards,

              Radovan