Focal Point
Help with sweeping records in master file.

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7421090192

July 10, 2008, 10:49 AM
Tracie
Help with sweeping records in master file.
I have a current row (row1) that has a start and stop time. I need to search the master file for the next row (row2) that has run time greater than 0. Once I have that row I need to take the stop time of row1 and subtract the start time of row 2. This will give me the time between when row 1 stopped and row 2 started. Any ideas how to do this in WebFocus? Thanks


WebFocus 7703
Windows 7
Output format: HTML, Excel, PDF
July 10, 2008, 11:07 AM
GinnyJakes
Tracie,

You can do this in a DEFINE. You have to 'save' the contents of the row1 start and stop time and not overwrite them until some condition is met. Then don't calculate elaspsed time until runtime greater than 0.

Here is some pseudo-code that will possibly give you some ideas.

DEFINE FILE filename
CNTR/I8=CNTR+1;
CURRSTRT/I4=IF CNTR EQ 1 THEN STARTTIME ELSE CURRSTRT;
CURRSTOP/I4=IF CNTR EQ 1 THEN STOPTIME ELSE CURRSTOP;
ELAPSED/I8=IF RUNTIME GT 0 THEN 'calculate elapsed time';
END


This of course needs lots of work but might give you an idea of what you need to do.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
July 10, 2008, 11:27 AM
Danny-SRL
Tracie,
What happens after you found row 2? do you look for row 3 and do the same calculation between 3 and 2?
Also, is your file sequential?

If this hypotheses is correct could this be your solution:
  
-* File tracie1.fex
DEFINE FILE CAR
RUNTIME/I5=IF SALES LT 10000 THEN 0 ELSE SALES;
START/D7=RCOST;
ENDT/D7=DCOST;
END
TABLE FILE CAR
PRINT COUNTRY CAR MODEL START ENDT RUNTIME
END
TABLE FILE CAR
PRINT COUNTRY CAR MODEL START ENDT RUNTIME
COMPUTE DIFF/D7=IF LAST ENDT EQ 0 THEN 0 ELSE START - LAST ENDT;
IF RUNTIME NE 0
END

This message has been edited. Last edited by: Danny-SRL,


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF