Focal Point
Descending order [SOLVED]

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

October 20, 2010, 09:38 AM
Krishna.edara
Descending order [SOLVED]
Hi All,
i want my Counter should be in descending order and also i want only first 5 records
 
-DEFAULT &END_DATE = 100110
-SET &END_DATE = EDIT(&END_DATE, '99/') | EDIT(&END_DATE, '$$99$$/') | EDIT(&END_DATE, '$$$$99') ;
DEFINE FILE CAR
COUNTER/I5 = 1;
END
TABLE FILE CAR
SUM
CAR
MODEL
COUNTER
BY CAR NOPRINT
WHERE DEALER_COST GE 4915
END
 


Thanks,
Krish.

This message has been edited. Last edited by: Krishna.edara,


WebFocus-8/Windows/HTML, PDF, EXCEL
October 20, 2010, 09:47 AM
Prarie
  DEFAULT &END_DATE = 100110
- INCLUDE MXTRACKLOG.FEX
-SET &END_DATE = EDIT(&END_DATE, '99/') | EDIT(&END_DATE, '$$99$$/') | EDIT(&END_DATE, '$$$$99') ;
DEFINE FILE CAR
COUNTER/P8 WITH CAR =LAST COUNTER+1;

END
TABLE FILE CAR
SUM
CAR
MODEL
 
BY LOWEST 5 COUNTER  
BY CAR NOPRINT
WHERE DEALER_COST GE 4915
END
 



October 20, 2010, 11:01 AM
Krishna.edara
Hi Prarie,
Thanks for reply...
it is working fine but it is not reaching my requirement,
the model should count if it repeats(iam counting the repeted Models only )
iam getting with following code but iam unable to get the highest 5 in Decending order.
In this Example the Model is not repeting, but in my case it will repeate so i want to count them and should show in Decending order of first 5

 
DEFINE FILE CAR
COUNTER/P8 =1;
END
TABLE FILE CAR
SUM
CAR
MODEL
COUNTER
BY HIGHEST 5 COUNTER  NOPRINT
BY CAR NOPRINT
BY MODEL NOPRINT
WHERE DEALER_COST GE 4915
END 


Thanks,
Krish.

This message has been edited. Last edited by: Krishna.edara,


WebFocus-8/Windows/HTML, PDF, EXCEL
October 20, 2010, 11:29 AM
EWoerle
krish,

I'm unclear of what the purpose of your counter is? If you just want the first 5 records in a table then I would use WHERE RECORDLIMIT EQ 5 to get the first 5 records. But then you have no control over the actual order that they are in. What do you mean the Model should count if it repeats? In this example if you want to know the 5 Countries that have more then 1 car I would write my code as such:
(I changed it to 3 Countries that have more then 1 car because there weren't enough qualifying countries that satisfied the point.)

  
DEFINE FILE CAR
COUNTER/I8=1;
END
TABLE FILE CAR
SUM COUNTER
	CAR NOPRINT
	MODEL NOPRINT
BY HIGHEST TOTAL COUNTER
BY COUNTRY
WHERE TOTAL COUNTER GT 1
ON TABLE HOLD AS CARS
END
TABLE FILE CARS
PRINT COUNTER
BY HIGHEST  COUNTER
BY COUNTRY
WHERE RECORDLIMIT EQ 3
END


Am I close to understanding what you are trying to acheive?


Eric Woerle
WF 7.6.7 Reportting Server
ETL 7.6.10
Dev Studio 7.6.7
October 20, 2010, 11:30 AM
Prarie
Something like this?

IF MODEL EQ LAST MODEL THEN COUNTER+1 ELSE 0;

You will have to set the counter to 0 to start.

Do some searches here on the Forum of different ways to do counters.

Search on COUNTER
October 20, 2010, 11:46 AM
Krishna.edara
Hi EWoerle,
My actual intention is to count the Hits on Tag and show the top 5 Hits on Tag,
Here is my actual code iam using

 
-DEFAULT &END_DATE = 101010
-SET &END_DATE = EDIT(&END_DATE, '99/') | EDIT(&END_DATE, '$$99$$/') | EDIT(&END_DATE, '$$$$99') ;
DEFINE FILE LOG
HIT/P8 = 1;
HITS/P8 WITH TAG =HIT;
END
TABLE FILE LOG
SUM
PROGRAM 
TAG 
HITS 
BY HIGHEST 5 HITS NOPRINT
BY PROGRAM NOPRINT
BY TAG  NOPRINT
WHERE LOGDATE GE '&END_DATE'
END


Thanks,
Krish.


WebFocus-8/Windows/HTML, PDF, EXCEL
October 20, 2010, 11:55 AM
EWoerle
Krish,

Have you tried either of the suggestions that Prarie or I have given you? It seems that either one or a combination of the both should have your answer in it. Is there a piece of either one of our codes that you would like us to explain better that maybe you didn't understand?

From what I am reading you want to know who your top 5 users are that are running reports. If that is correct then you have everything you need to acheive that and me writing the report for you will not help you learn.


Eric Woerle
WF 7.6.7 Reportting Server
ETL 7.6.10
Dev Studio 7.6.7
October 20, 2010, 12:08 PM
Krishna.edara
Thanks EWoerle and Prarie,
It did worked for me.

Thanks,
Krish.


WebFocus-8/Windows/HTML, PDF, EXCEL
October 20, 2010, 05:06 PM
Waz
Krish, have you considered going on training, it will assist you in some of these basic questions.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!