Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using for loop in load

Hi,

I have the table which defines the standard costs for each country and material. In database these standard costs are defined only on 1st January of each year. So I have:
DATE_ID:
20050101
20060101
20070101
20080101
20090101
20100101
20110101
20120101
20130101

Now I need to multiplicate in my load the material standard price for each month based on the year I select in my list box. For example, if I want to analyze 2013, I need to visualize the same standard price for each month up to the end of the year:
DATE_ID  LOCALSTDPRICE EURSTDPRICE USDSTDPRICE
20130101                          3.5                      7.2                 5.3
20130201                          3.5                      7.2                 5.3
20130301                          3.5                      7.2                 5.3
20130401                          3.5                      7.2                 5.3
20130501                          3.5                      7.2                 5.3
20130601                          3.5                      7.2                 5.3
20130701                          3.5                      7.2                 5.3
20130801                          3.5                      7.2                 5.3
20130901                          3.5                      7.2                 5.3
20131001                          3.5                      7.2                 5.3
20131101                          3.5                      7.2                 5.3

20131201                          3.5                      7.2                 5.3
considering the related country, material and currency as well.

My load script is the following:

LOAD
     COUNTRY_ID,
     MAT_ID_MATERIAL,
     DATE_ID,
     CR_ID_CURRENCY,
     LOCAL_UNIT_STANDARD_PRICE,
     EUR_UNIT_STANDARD_PRICE,
     USD_UNIT_STANDARD_PRICE
FROM
[ST_F_UNIT_STANDARD_COST.qvd](qvd)


I think I can use a for loop but I've never used it and I don't know how I should proceed.
Any suggest is welcomed.

Thank you

1 Reply
Gysbert_Wassenaar

LOAD

     COUNTRY_ID,

     MAT_ID_MATERIAL,

     DATE_ID + 100*(iterno()-1) as DATE_ID,

     CR_ID_CURRENCY,

     LOCAL_UNIT_STANDARD_PRICE,

     EUR_UNIT_STANDARD_PRICE,

     USD_UNIT_STANDARD_PRICE

FROM

[ST_F_UNIT_STANDARD_COST.qvd](qvd)

while iterno() <=12;


talk is cheap, supply exceeds demand