3 Replies Latest reply: Aug 4, 2015 2:20 AM by Jonathan Dienst RSS

    When to use $(variable) and when just to use variable?

    Simon Hogg

      I'm a bit confused on when to use $(variable) and when just to use variable.  I have the following script;

       

      For vYear = 2010 to 2015

      For vMonth = 1 to 12

      vMonth = vYear & NUM(vMonth,'00')

       

      <Do stuff>

      WHERE {[0CALMONTH].[$(vmonth))]};

       

      But should that bolded line be vMonth = $(vYear) & NUM ($(vMonth),'00')?

      As far as I can tell they do the same thing (in this instance).

       

      I understand that $(variable) is saying "don't interpret this as a literal string" but that doesn't always matter, so is it just a matter of "best practice" to always use $(variable) or is there actually different functionality?

       

      Thanks.