Focal Point
[CLOSED] Conditional Column Styling

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

February 07, 2011, 02:28 AM
Arpita
[CLOSED] Conditional Column Styling
Hi!
In my report, i have to conditionally highlight the columns based on the condition, if the field NIGHT_IND is 'Y'.
In our report we have IN and OUT events for 7days.All the In and Out fields are coming from define file.
We already have a field called 'NIGHT_IND', with value 'Y' or 'N', to identify, whether that field needs to be highlighted or not.
I have tried to put the condition for 2 column, but its not working fine.

Please Help.

Thanks
Arpita

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6
Windows, All Outputs
February 07, 2011, 03:40 AM
Wep5622
Should work just fine, maybe you can show what you're trying to do?

A few things to check for:
- Is your NIGHT_IND column in your TABLE FILE? If it's only in the DEFINE FILE, then the stylesheet can't see it. You should at least PRINT or SUM the column, probably marked as NOPRINT, or your stylesheet won't pick it up.
- Are the columns you're trying to style part of an ACROSS? In that case you may have to refer to the NIGHT_IND column numerically (using N1, N2, or whatever number is applicable for you).


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
February 07, 2011, 04:08 AM
Wep5622
Wrap your code in CODE tags, not QUOTE tags Wink

I can't see any references to that macro, are you using it at all?
We don't really need all your code, just the relevant sections of the problematic DEFINE FILE, TABLE FILE and stylesheet would have sufficed I think.

I do suppose you checked that there are no errors printed in the resulting output?


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
February 07, 2011, 05:36 AM
Wep5622
What is the problem?

The relevant bit of code seems to be:
 
TABLE FILE V_SPTR0001_TAB
SUM
  MAX.SUN_IN  AS 'In'
  MAX.SUN_OUT AS 'Out'

...

     DEFMACRO=DEF001,
     MACTYPE=RULE,
     BORDER-TOP-COLOR='SILVER',
     BORDER-BOTTOM-COLOR='SILVER',
     BORDER-LEFT-COLOR='SILVER',
     BORDER-RIGHT-COLOR='SILVER',
     BACKCOLOR='SILVER',
     WHEN=NIGHT_IND EQ 'Y',
$

...

TYPE=DATA,
     COLUMN=N10,
     FONT='ARIAL',
     SIZE=9,
     STYLE=NORMAL,
  MACRO=DEF001,
$
TYPE=DATA,
     COLUMN=N11,
     BORDER-TOP-COLOR='SILVER',
     BORDER-BOTTOM-COLOR='SILVER',
     BORDER-LEFT-COLOR='SILVER',
     BORDER-RIGHT-COLOR='SILVER',
     FONT='ARIAL',
     SIZE=9,
     STYLE=NORMAL,
  MACRO=DEF001,
$


What jumps out is that you repeated the border-styling in the style for column N11 (the macro should take care of that) and that your border-colours are the same as the cell background colour (is that intentional?).

Without knowing the problem, it's going to be hard to help you. If you're having trouble describing it, you may be able to whip up an example using one of the IBI sample databases (CAR, for example)?


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
February 07, 2011, 07:46 AM
Wep5622
Sorry, you're being way too vague.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
February 07, 2011, 08:59 AM
Doug
Vague: Yes. If you're having trouble using / understanding the use of MACROs in style sheets, then, perhaps you should check out the "WHEN", as used in style sheets...




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
February 07, 2011, 11:12 AM
Ram Prasad E
Using AlphaNumeric field under SUM will fetch last value within that group. On which you added conditional styling. Just remove the NOPRINT on 'V_SPTR0001_TAB.SEG01.NIGHT_IND' and see how the data looks for NIGHT_IND. For better understanding on this, refer to the below code.

DEFINE FILE CAR
CAR_IND/A1=IF BODYTYPE EQ 'SEDAN' THEN 'Y' ELSE 'N';
END
TABLE FILE CAR
SUM
CAR_IND
SALES
BY COUNTRY
BY BODYTYPE
ON TABLE SET STYLE *
TYPE=DATA, BACKCOLOR=GREY, WHEN=CAR_IND EQ 'Y', $
ENDSTYLE
END
-RUN

DEFINE FILE CAR
CAR_IND/A1=IF BODYTYPE EQ 'SEDAN' THEN 'Y' ELSE 'N';
END
TABLE FILE CAR
SUM
CAR_IND 
SALES
BY COUNTRY
-*BY BODYTYPE
ON TABLE SET STYLE *
TYPE=DATA, BACKCOLOR=GREY, WHEN=CAR_IND EQ 'Y', $
ENDSTYLE
END
-RUN



TABLE FILE CAR
PRINT
COUNTRY
CAR
END
-RUN



TABLE FILE CAR
SUM
COUNTRY
CAR
END
-RUN


TABLE FILE CAR
SUM
LST.COUNTRY
LST.CAR
END





WebFOCUS 8.1.05
Windows
http://ibiwebfocus.wordpress.com
https://www.facebook.com/groups/ibi.webfocus/