 Former Member

# FOX formula problem

Hi,

I am trying to do a distribution using the FOX formula below but find that the upper FISCPER value in the FISCPER foreach loops are not being restricted to the FISCPER values that are found in the Project of that particular iteration. Rather they are going to the highest Fiscal Period value to be found in that dataset.

Apart from this problem the distribution gives me what I want. Question is can FOX give me what I want (how?) or do I need to use a User Exit function?

Any ideas/solutions to this.

regards,

Alex

==============

DATA FISCPER TYPE 0FISCPER.

DATA CURRPER TYPE 0FISCPER.

DATA PROJECT TYPE ZPROJECT.

DATA SUMLPLAN TYPE F.

DATA SUMATD TYPE F.

DATA DTRPFCAST TYPE F.

DATA FCOUNTER TYPE I.

• Periods read from variable ZPERIOD

CURRPER = VARV( 'ZPERIOD' ).

*PROJECT = VARV( 'ZVPROJ' ).

• FCOUNTER = 0.

FOREACH PROJECT.

• FCOUNTER = 0.

MESSAGE I001(PROJECT) WITH PROJECT.

MESSAGE I001(CURRPER) WITH CURRPER.

SUMATD = 0.

SUMLPLAN = 0.

FCOUNTER = 0.

FOREACH FISCPER.

• Sum PLAN

SUMLPLAN = { EUR,S,FISCPER,NW,020,PROJECT } +

SUMLPLAN.

IF FISCPER <= CURRPER.

• Sum ACTUAL TO DATE

SUMATD = { EUR,S,FISCPER,000,010,PROJECT } +

SUMATD.

• Zero out prior latest plans

{ EUR,S,FISCPER,NW,020,PROJECT } = 0.

ENDIF.

• Determine remaining number of periods

IF FISCPER > CURRPER.

FCOUNTER = FCOUNTER + 1.

ENDIF.

ENDFOR.

• Determine new standard Forecast per future period

DTRPFCAST = 0.

DTRPFCAST = (SUMLPLAN - SUMATD)/FCOUNTER.

• Redistribute Forecast

FOREACH FISCPER.

IF FISCPER > CURRPER.

{ EUR,S,FISCPER,NW,020,PROJECT } = FCOUNTER.

ENDIF.

ENDFOR.

ENDFOR.

10|10000 characters needed characters exceeded

### Related questions

• Former Member
Posted on Sep 26, 2005 at 02:37 PM

Alex,

The individual foreach fonction will run to all fiscal periods of the complete dataset independent the project. Only a combination of FOREACH FISCPER,PROJECT. could restrict it.

The statement

{ EUR,S,FISCPER,NW,020,PROJECT } = FCOUNTER.

Will therefor run untill the highest Fiscper in the complete dataset. If you wan't to restrict it to the highest FISCPER of the project you can use for example in the start a new fiscper variable ex FISCPER2.

And track the highest FISCPER of the combination Project fiscper.

for example

FOREACH FISCPER,PROJECT.

IF { EUR,S,FISCPER,NW,020,PROJECT } <> 0.

FISCPER2 = FISCPER.

ENDIF.

ENDFOR.

And then

FOREACH FISCPER.

IF FISCPER > CURRPER AND FISCPER <=FISCPER2.

{ EUR,S,FISCPER,NW,020,PROJECT } = FCOUNTER.

ENDIF.

ENDFOR.

ENDFOR.

10|10000 characters needed characters exceeded
• Former Member

Kris - many thanks + 10 points.

Elegant & effective suggestion which did the biz.

best regards,

Alex

• Posted on Sep 26, 2005 at 05:05 PM

Hi Alex,

As per your information it sounds me that the values in variables not cleared, Do check in Debug mode,Clear the values of variables TYPE F and have a check.

Regds,

Ven Venkat