8 Replies Latest reply: Apr 29, 2011 8:58 AM by Sravan Puppala RSS

    Define Variable based on week

    Sravan Puppala

      Hi I have this problem with the loop.

      I am looping with the weeks and my loop is for 201115[vCurrweek] to 201118($(vCurWeek)+3)

      If the "week" Field in Temp_table is same as $(Vcurrweek) I want to save the stock as variable Stock.

      I dont know how to write this

      I tried

      Let Stock = Peek('WeeklyStock');

      But it does not give me the Stockvalue when week is 'i'



      SET CV= '0';

      For i= $(vCurWeek) to ($(vCurWeek)+3)

      SID_0CALWEEK as Week,
      Material as Material,
      SID_CMATLOC as [Location],
      [Weekly Material Stock] as WeeklyStock,
      [Weekly Material Demand] as WeeklyDemand
      Resident FactTable

      if($(i) = Fieldvalue(Week)) then
      Let Stock = Fieldvalue('WeeklyStock');

      If($(Stock) <= 0) then $(CV) else
      exit script()
      End If