Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Solved]Background color is not working if styling condition is not in same imgcolumn
Go
New
Search
Notify
Tools
Reply
  
[Solved]Background color is not working if styling condition is not in same imgcolumn
 Login/Join
 
Gold member
posted
Hello,

I have issue to load the background color in image column. Image column have some condition; so based on the 1st condition only images has to load!

in next condition we have to load the back-color based on the condition that-to different column which is not image condition!

 

DEFINE FILE CAR
IMG_INC/A50 	= 'icon_in.gif';
END

TABLE FILE CAR
PRINT 
COUNTRY	MPG
COMPUTE MPG_IMG/A10 = IF (MPG GT 0 AND MPG LE 10) THEN 'ORANGE' ELSE IF (MPG GT 11 AND MPG LE 20) THEN 'GREEN' ELSE IF (MPG GT 21) THEN 'BLUE' ELSE ''; 
COMPUTE COL/A10 = IF MPG_IMG EQ 'GREEN' THEN 'Y' ELSE 'N';
COMPUTE COUNTRYA/A50 = IF MPG_IMG EQ 'GREEN' THEN IMG_INC ELSE '';

ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,SQUEEZE=ON,PAGESIZE='Letter',ORIENTATION=LANDSCAPE,$
TYPE=REPORT,HEADALIGN=BODY,FONT='ARIAL', SIZE=9,LEFTGAP=0.02, RIGHTGAP=0.02, $
TYPE=DATA,BACKCOLOR=('WHITE' RGB(197 217 241)),JUSTIFY=CENTER,BORDER-TOP=LIGHT, BORDER-BOTTOM=LIGHT, BORDER-LEFT=LIGHT, BORDER-RIGHT=LIGHT, BORDER-TOP-STYLE=SOLID, BORDER-BOTTOM-STYLE=SOLID, BORDER-LEFT-STYLE=SOLID,BORDER-RIGHT-STYLE=SOLID,$

TYPE=DATA,COLUMN=COUNTRYA, IMAGE=(IMG_INC),SIZE=(0.10 0.1),JUSTIFY=RIGHT,WHEN = MPG_IMG EQ 'GREEN',$
 [B] -*TYPE=DATA, COLUMN=COUNTRYA, BACKCOLOR=RED, WHEN = MPG_IMG EQ 'GREEN',$
TYPE=DATA, COLUMN=COUNTRYA, BACKCOLOR=RED, WHEN = COL EQ 'Y',$
[/B]
ENDSTYLE
END
-EXIT
 


Please let me your thoughts!!

Thanks in Advance

Regards,
Dev
(8105M)

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


8202, 8105M, 7.7.03
 
Posts: 79 | Registered: June 12, 2012Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Not sure to understand what you're attempting to accomplish.

When I run your code I have red background behind image and this only for rows where MPG_IMG = 'GREEN'.
The only thing that doesn't have any effect it the right justify.

DEFINE FILE CAR
IMG_INC/A50 = 'icon_in.gif';
END

TABLE FILE CAR
PRINT COUNTRY	MPG
      COMPUTE MPG_IMG  /A10 = IF (MPG GT 0 AND MPG LE 10) THEN 'ORANGE' ELSE IF (MPG GT 11 AND MPG LE 20) THEN 'GREEN' ELSE IF (MPG GT 21) THEN 'BLUE' ELSE ''; 
      COMPUTE COUNTRYA /A50 = IF MPG_IMG EQ 'GREEN' THEN IMG_INC ELSE '';
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     PAGESIZE='Letter',
     ORIENTATION=LANDSCAPE,
$
TYPE=REPORT,
   HEADALIGN=BODY,
   FONT='ARIAL',
   SIZE=9,
   LEFTGAP=0.02,
   RIGHTGAP=0.02, $
TYPE=DATA,
   BACKCOLOR=('WHITE' RGB(197 217 241)),
   JUSTIFY=CENTER,
   BORDER=LIGHT,
   BORDER-STYLE=SOLID,
$
TYPE=DATA,
   COLUMN=COUNTRYA,
   JUSTIFY=RIGHT,
   IMAGE=(IMG_INC),
   SIZE=(0.1 0.1),
   POSITION=(+10.00 +0.00),
   WHEN = MPG_IMG EQ 'GREEN',
$
TYPE=DATA,
   COLUMN=COUNTRYA,
   JUSTIFY=RIGHT,
   BACKCOLOR=RED,
   WHEN = MPG_IMG EQ 'GREEN',
$
ENDSTYLE
END


Can you share an image or sample of what your are attempting to have as result ?


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2410 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Gold member
posted Hide Post
We have to apply backcolor in COUNTRYA Column based on the below condition. Same COUNTRYA contains image based on different condition!

 TYPE=DATA, COLUMN=COUNTRYA, BACKCOLOR=RED, WHEN = COL EQ 'Y',$ 


If we apply the condition it won't work!

Want to know is there any way or am doing it right?


8202, 8105M, 7.7.03
 
Posts: 79 | Registered: June 12, 2012Reply With QuoteReport This Post
Virtuoso
posted Hide Post
It's still not clear for me.

In your report you have defined two conditions :

1- MPG_IMG /A10 = IF (MPG GT 0 AND MPG LE 10) THEN 'ORANGE' ELSE IF (MPG GT 11 AND MPG LE 20) THEN 'GREEN' ELSE IF (MPG GT 21) THEN 'BLUE' ELSE '';
2- COL     /A10 = IF MPG_IMG EQ 'GREEN' THEN 'Y' ELSE 'N';

Where you try to apply differently :

TYPE=DATA, COLUMN=COUNTRYA, BACKCOLOR=RED, WHEN = MPG_IMG EQ 'GREEN',$
TYPE=DATA, COLUMN=COUNTRYA, BACKCOLOR=RED, WHEN = COL EQ 'Y',$

But in fact it's the SAME condition. When Col EQ 'Y' it's because MPG_IMG EQ 'GREEN'.
So the image will be displayed in COUNTRYA when MPG_IMG EQ 'GREEN' (or Col EQ 'Y') and the cell background of COUNTRYA will be Red when Col EQ 'Y' (or MPG_IMG EQ 'GREEN').

As I put in my sample, the way you've defined your condition you can either use :
WHEN = MPG_IMG EQ 'GREEN',

or
WHEN = COL EQ 'Y',

it's the same thing since they result from the same condition but with a different way to express the result.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2410 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Platinum Member
posted Hide Post
quote:
posted January 12, 2018 06:06 PM
Hello,

I have issue to load the background color in image column. Image column have some condition; so based on the 1st condition only images has to load!

in next condition we have to load the back-color based on the condition that-to different column which is not image condition!



Try Below mentioned code ,

This code will display image to "COUNTRYA" Column if Col EQ 'Y' else it will display "COUNTRYA" column blank having Red background


 
DEFINE FILE CAR
IMG_INC/A50 	= 'icon_in.gif';
END

TABLE FILE CAR
PRINT 
COUNTRY	
MPG
COMPUTE MPG_IMG/A10 = IF (MPG GT 0 AND MPG LE 10) THEN 'ORANGE' ELSE IF (MPG GT 11 AND MPG LE 20) THEN 'GREEN' ELSE IF (MPG GT 21) THEN 'BLUE' ELSE ''; 
COMPUTE COL/A10 = IF MPG_IMG EQ 'GREEN' THEN 'Y' ELSE 'N';
COMPUTE COUNTRYA/A50 = IF MPG_IMG EQ 'GREEN' THEN IMG_INC ELSE ''; 

ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,SQUEEZE=ON,PAGESIZE='Letter',ORIENTATION=LANDSCAPE,$
TYPE=REPORT,HEADALIGN=BODY,FONT='ARIAL', SIZE=9,LEFTGAP=0.02, RIGHTGAP=0.02, $
TYPE=DATA,BACKCOLOR=('WHITE' RGB(197 217 241)),JUSTIFY=CENTER,BORDER-TOP=LIGHT, BORDER-BOTTOM=LIGHT, BORDER-LEFT=LIGHT, BORDER-RIGHT=LIGHT, BORDER-TOP-STYLE=SOLID, BORDER-BOTTOM-STYLE=SOLID, BORDER-LEFT-STYLE=SOLID,BORDER-RIGHT-STYLE=SOLID,$


TYPE=DATA, COLUMN = N5, BACKCOLOR=RED, WHEN = COL EQ 'N',$
TYPE=DATA,COLUMN=COUNTRYA, IMAGE=(IMG_INC),SIZE=(0.10 0.1),JUSTIFY=RIGHT, $
ENDSTYLE
END
-EXIT 

Hope it helps


WF Production :- WF:8.0.0.4, 8.1.05 App-studio/Developer Studio(8.1.x) ,
8.2.0.1M , 8.2.0.2 (App-Studio8.2.x),
InfoAssist/+, InfoDiscovery
Output format:-AHTML, PDF, Excel, HTML
Platform:-Windows 7, 8,10
 
Posts: 186 | Location: Infobuild India | Registered: August 28, 2015Reply With QuoteReport This Post
Gold member
posted Hide Post
Here the sample data for my output.

I have two different condition need to apply in single column.
1. Display the image(Icon) before the code column whenever the flag is 'Y'
2. change the backcolor to red in code column whenever the value is LT 80;

This is what I am trying now.

I loaded the image based on the condition and the backcolor.

Issue is if the image is present in the column can't able to load the backcolor? Don't know why the backcolor is not loading if image is present.
While loading image. I created a dummy column before the code and load the images based on the flag and backcolor both columns!

 
Code  Flag  Value
CUEQB Y 75
FQCCB Y 75
GQ6KA Y 75
CF33V Y 76
CF33M Y 77
EH0EA N 77
GE9HA N 77
B556V Y 78
C7E3F Y 78
C83HA Y 78
C83HF Y 78
C83HT Y 78
C83HV Y 78
CF33G Y 78
CUEQD Y 78
CXEYC Y 78
CXEYE Y 78
DZL7D Y 78
DZL7S Y 78
EM2BB Y 78
EQ9GM Y 78
FTR5A N 78
GQ6KD Y 78
R5FPJ Y 78
T5BVG Y 78
T5BVH Y 78
T5BVK Y 78
C7E3A Y 83

 


Hope now it will make sense?

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


8202, 8105M, 7.7.03
 
Posts: 79 | Registered: June 12, 2012Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Is that what you're looking for ?

In my sample I'm using MACRO instead of WHEN in the styling.
I personally prefer MACRO since you don't need to repeat the condition (X EQ Y) several times. So if the condition change there is only one place to modify.

DEFINE FILE CAR
IMG    /A5  = '     ';
IMG_INC/A50 = 'dot_blue.gif';
END
TABLE FILE CAR
SUM SEATS
    RETAIL_COST
    IMG_INC NOPRINT
BY IMG AS ''
BY COUNTRY
BY CAR
BY MODEL

ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     PAGESIZE='Letter',
     ORIENTATION=LANDSCAPE,
$
     DEFMACRO=DSP_IMG,
     MACTYPE=RULE,
     WHEN = SEATS LT 5,
$
     DEFMACRO=BACK_RED,
     MACTYPE=RULE,
     WHEN = RETAIL_COST GT 10000,
$
TYPE=REPORT,
   HEADALIGN=BODY,
   FONT='ARIAL',
   SIZE=9,
$
TYPE=DATA,
   BACKCOLOR=('WHITE' RGB(197 217 241)),
   JUSTIFY=CENTER,
   BORDER=LIGHT,
   BORDER-STYLE=SOLID,
$
TYPE=DATA,
   COLUMN=IMG,
   IMAGE=(IMG_INC),
   SIZE=(0.1 0.1),
   POSITION=(+10.00 +0.00),
   MACRO=DSP_IMG,
$
TYPE=DATA,
   COLUMN=MODEL,
   BACKCOLOR=RED,
   MACRO=BACK_RED,
$
ENDSTYLE
END


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2410 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Platinum Member
posted Hide Post
quote:
Display the image(Icon) before the code column whenever the flag is 'Y'
2. change the backcolor to red in code column whenever the value is LT 80;


What if flag is 'Y' and value is LT 80 ?

quote:
Display the image(Icon) before the code column


Do you have an extra column before to code Column where you will display the image and change the code column's background color RED ?


WF Production :- WF:8.0.0.4, 8.1.05 App-studio/Developer Studio(8.1.x) ,
8.2.0.1M , 8.2.0.2 (App-Studio8.2.x),
InfoAssist/+, InfoDiscovery
Output format:-AHTML, PDF, Excel, HTML
Platform:-Windows 7, 8,10
 
Posts: 186 | Location: Infobuild India | Registered: August 28, 2015Reply With QuoteReport This Post
Gold member
posted Hide Post
quote:
What if flag is 'Y' and value is LT 80 ?

We have to display only image and no background color.

if the flag is 'Y' we have show the image right, so instead of concatenating both image and code in single column. I created one more before the code and hide the borders. so from user perspective it will show as a single image.

I don't know how to image in this forum. otherwise I will share my output to you!


8202, 8105M, 7.7.03
 
Posts: 79 | Registered: June 12, 2012Reply With QuoteReport This Post
Platinum Member
posted Hide Post
quote:
I don't know how to image in this forum. otherwise I will share my output to you!


upload the image in public domain and add the URL in the Message box.


WF Production :- WF:8.0.0.4, 8.1.05 App-studio/Developer Studio(8.1.x) ,
8.2.0.1M , 8.2.0.2 (App-Studio8.2.x),
InfoAssist/+, InfoDiscovery
Output format:-AHTML, PDF, Excel, HTML
Platform:-Windows 7, 8,10
 
Posts: 186 | Location: Infobuild India | Registered: August 28, 2015Reply With QuoteReport This Post
Gold member
posted Hide Post
quote:
Originally posted by MartinY:
Is that what you're looking for ?

In my sample I'm using MACRO instead of WHEN in the styling.
I personally prefer MACRO since you don't need to repeat the condition (X EQ Y) several times. So if the condition change there is only one place to modify.



MartinY - As per your code; Red highlighted in Model column is correct and also we need to highlight the same rows in image back-color!
Whenever the model record is highlighted we have to change the back-color in image column as well!


8202, 8105M, 7.7.03
 
Posts: 79 | Registered: June 12, 2012Reply With QuoteReport This Post
Virtuoso
posted Hide Post
I don't think that you'll be able to perform what you're looking for : red background behind IMG cell when MODEL is red. It's either the image or the background, cannot have both in this case.

What I suggest is to have two different images displayed according to the condition.

In my sample, MODEL will be red background when RETAIL_COST over 10K and display a red image instead of the blue when the image should be displayed.

DEFINE FILE CAR
IMG    /A5  = '     ';
IMG_INC/A50 = IF RETAIL_COST GT 10000 THEN 'dot_red.gif' ELSE 'dot_blue.gif';
END
TABLE FILE CAR
SUM SEATS
    RETAIL_COST
    IMG_INC NOPRINT
BY IMG AS ''
BY COUNTRY
BY CAR
BY MODEL

ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     PAGESIZE='Letter',
     ORIENTATION=LANDSCAPE,
$
     DEFMACRO=DSP_IMG,
     MACTYPE=RULE,
     WHEN = SEATS LT 5,
$
     DEFMACRO=BACK_RED,
     MACTYPE=RULE,
     WHEN = RETAIL_COST GT 10000,
$
TYPE=REPORT,
   HEADALIGN=BODY,
   FONT='ARIAL',
   SIZE=9,
$
TYPE=DATA,
   BACKCOLOR=('WHITE' RGB(197 217 241)),
   JUSTIFY=CENTER,
   BORDER=LIGHT,
   BORDER-STYLE=SOLID,
$
TYPE=DATA,
   COLUMN=IMG,
   IMAGE=(IMG_INC),
   SIZE=(0.1 0.1),
   POSITION=(+10.00 +0.00),
   MACRO=DSP_IMG,
$
TYPE=DATA,
   COLUMN=MODEL,
   BACKCOLOR=RED,
   MACRO=BACK_RED,
$
ENDSTYLE
END


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2410 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Virtuoso
posted Hide Post
I do revise my previous post.

It is possible, BUT the STYLING order is VERY IMPORTANT !!

You NEED to perform DBL_COND conditional styling BEFORE doing DSP_IMG conditional styling.

DEFINE FILE CAR
IMG    /A5  = '     ';
IMG_INC/A50 = IF RETAIL_COST GT 10000 THEN 'dot_yellow.gif' ELSE 'dot_blue.gif';
END
TABLE FILE CAR
SUM SEATS
    RETAIL_COST
    IMG_INC NOPRINT
    COMPUTE DBL_CND /A1 = IF SEATS LT 5 AND RETAIL_COST GT 10000 THEN 'Y' ELSE 'N'; NOPRINT
BY IMG AS ''
BY COUNTRY
BY CAR
BY MODEL

ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     PAGESIZE='Letter',
     ORIENTATION=LANDSCAPE,
$
     DEFMACRO=DSP_IMG,
     MACTYPE=RULE,
     WHEN = SEATS LT 5,
$
     DEFMACRO=BACK_RED,
     MACTYPE=RULE,
     WHEN = RETAIL_COST GT 10000,
$
     DEFMACRO=DBL_COND,
     MACTYPE=RULE,
     WHEN = DBL_CND EQ 'Y',
$
TYPE=REPORT,
   HEADALIGN=BODY,
   FONT='ARIAL',
   SIZE=9,
$
TYPE=DATA,
   BACKCOLOR=('WHITE' RGB(197 217 241)),
   JUSTIFY=CENTER,
   BORDER=LIGHT,
   BORDER-STYLE=SOLID,
$
TYPE=DATA,
   COLUMN=IMG,
   IMAGE=(IMG_INC),
   BACKCOLOR=RED,
   SIZE=(0.1 0.1),
   POSITION=(+10.00 +0.00),
   MACRO=DBL_COND,
$
TYPE=DATA,
   COLUMN=IMG,
   IMAGE=(IMG_INC),
   SIZE=(0.1 0.1),
   POSITION=(+10.00 +0.00),
   MACRO=DSP_IMG,
$
TYPE=DATA,
   COLUMN=MODEL,
   BACKCOLOR=RED,
   MACRO=BACK_RED,
$
ENDSTYLE
END


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2410 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Gold member
posted Hide Post
quote:
I do revise my previous post.

It is possible, BUT the STYLING order is VERY IMPORTANT !!

You NEED to perform DBL_COND conditional styling BEFORE doing DSP_IMG conditional styling.


Many Thanks MartinY!!

I found the issue now as per your code. we have to load the backcolor in image column first(BACK_RED) and then the image condition (DSP_IMG)!!!
This is strange but it works good Smiler


8202, 8105M, 7.7.03
 
Posts: 79 | Registered: June 12, 2012Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Solved]Background color is not working if styling condition is not in same imgcolumn

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.