3 Replies Latest reply: Jul 22, 2010 4:10 AM by ttierraa RSS

    SQL Statement in LET Statement

      Hi All,

      Can I use the SQL Statement in LET statement. For example I want to calculate the minimum date from a table initialize to a variable. So that it can be used in my calender.

      For example I want do some thing like the below one to that I can use vDateMin in any of the variable for MinDate in my calender.

       


      LET vDateMin = SQL Select min(d_entry_date) from Tbl_DWR;


        • SQL Statement in LET Statement
          Shumail Hussain

          As per my knowledge you cant put sql query in a variable at script level but you can do it at the design / development level by defining variable in document.

          Regards,
          Shumail Hussain

          • SQL Statement in LET Statement
            sunil jain

            Dear Rikab,

            Let Statement works like variable declaration and Initialization. So during that time you cant assign value from any backend tool.

             

            Regards,

            Sunil Jain.

            • SQL Statement in LET Statement
              ttierraa

              This can be work for you.

              We can get a value from a table, such in that example:

              Currrency:
              LOAD * INLINE [
              "X" , "XValue"
              usd , usdValue
              eur , eurValue
              tl , tlValue
              ];
              SET vCurrency = '=Minstring("XValue")';

               

              So if you store your result on a table, you can use its columns, and take into a variable.
              If we customize to your case, You can try this:

              MinDate:
              SQL Select min(d_entry_date) As mDate from Tbl_DWR;

              SET vCurrency = '=Minstring("mDate")';