Current php in scriptcase

Hi all

I have a php script that calls a sql. I was just wondering how i would do it in scriptcase.

Below is the sql.

SET @row_num := 0;

select (@row_num := @row_num + 1) AS row_num,
       ipdate,
       product,
       market_value_1,

       (select market_value_1
        from (select t3.ipdate, t3.market_value_1, t3.product
              from report_combined t3
              where t3.product = 'ASISA MA High Equity Composite'
                and t3.ipdate between '2013-11-01' and '2013-12-01'
              group by t3.ipdate, t3.market_value_1, t3.product) t2
        where t2.ipdate < t1.ipdate
        order by t2.ipdate desc
        limit 1)                     prev_day,
       if(@row_num = 1, 100,  (select ((market_value_1/100) / ((prev_day/100) )))*100) calculated

from (select t1.ipdate,
             t1.product,
             t1.market_value_1
      from report_combined t1
      where product = 'ASISA MA High Equity Composite'
        and ipdate between '2013-11-01' and '2013-12-01'
      group by ipdate, product, market_value_1) t1
;

You can call from SCRIPTCASE a stored procedure with CALL. or you need create a grid app?

ths is a bit more complicated - the user wil have multiple products so the sql needs to run for every product and return values?

How do you run this code in a grid app?

You can try do your app grid with same SQL.
in: SQL Preparation you can set your variable: SET @row_num = 0;