[SOLVED] Reset a counter when By Field Value Changes
My Requirement is to add a Line break between every 5 rows.
I achievd it through the following code.
AND COMPUTE COUNTER=IF (COUNTER EQ 5) THEN 1 ELSE COUNTER+1; NOPRINT
BY BRAND_CODE AS 'Brand' NOPRINT BY REGION_CODE AS 'Region' NOPRINT BY AREA_CODE AS 'Area' NOPRINT BY BRANCH_NUMBER AS 'Branch' NOPRINT BY COUNTER NOPRINT ON COUNTER SUBFOOT " " WHEN COUNTER EQ 5
But I need to reset the counter value to 1 whenever there is change of value in any of the other BY fields.
Any Idea on how o do this ?This message has been edited. Last edited by: Kerry,
Thanks,
Ramkumar. WebFOCUS/Tableau Webfocus 8 / 7.7.02 Unix, Windows HTML/PDF/EXCEL/AHTML/XML/HTML5
July 14, 2010, 09:39 AM
Efrem
I'm not sure if the following is going to meet all of your needs but I would modify the COMPUTE statement for one of the BY phrases as follows:
AND COMPUTE COUNTER=IF (COUNTER EQ 5) OR (BRAND_CODE NE LAST BRAND_CODE) THEN 1 ELSE COUNTER+1; NOPRINT
You might have to modify the above statement to give you exactly what you're looking for.
July 14, 2010, 05:48 PM
Waz
Efrem is on the right track, but your will have to check all higher order by fields, so add a test for each of them.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
July 20, 2010, 12:56 AM
Ramkumar - Webfous
Thanks Efrem and Waz.. That worked Perfect. I had to implement that same logic for every other BY field as well.
Thanks,
Ramkumar. WebFOCUS/Tableau Webfocus 8 / 7.7.02 Unix, Windows HTML/PDF/EXCEL/AHTML/XML/HTML5