Focal Point
[CLOSED] Conditional Styling with Multiple "OR" Operators

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

August 04, 2020, 06:15 PM
AMC2
[CLOSED] Conditional Styling with Multiple "OR" Operators
Does anyone know how to conditionally style with multiple "OR" operators in your WHEN statement? This below does not work:

  
TYPE=DATA, ACROSSCOLUMN=MAX.AMT_FIELD, IMAGE=streamline_icon_check_circle_25px.png, WHEN=ROW_LBL EQ 'Select Provider Plus 5%' OR 'Select Provider Plus 10%', $


I get the bad value in stylesheet error message when using this code.

However, using just one condition works fine:
  
TYPE=DATA, ACROSSCOLUMN=MAX.AMT_FIELD, IMAGE=streamline_icon_check_circle_25px.png, WHEN=ROW_LBL EQ 'Select Provider Plus 5%', $

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8.2.06
SQL Server
HTML, PDF, Excel, etc
August 04, 2020, 06:47 PM
Waz
As the documentation states, only a single test can be done in a stylesheet when statement.

To have multiple, create a define or compute with the "OR", setting the result to "Y" or "N" for example and reference that field.


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!

August 04, 2020, 07:08 PM
AMC2
Waz - I had tried that already but my images show as broken images for some reason when doing it that way. Here's the DEFINE field and the style line:

 
TEST_FIL/A3 = IF ROW_LBL EQ 'Select Provider Plus 5%' OR 'Select Provider Plus 10%' OR 'Select Provider Plus 15%' OR 'Select Provider Plus 20%' OR 'Select Provider Plus 25%' OR 'Select Provider Plus 30%'
                 THEN 'YES' ELSE 'NOP';

TYPE=DATA, ACROSSCOLUMN=MAX.AMT_FIELD, IMAGE=streamline_icon_check_circle_25px.png, WHEN=TEST_FIL EQ 'YES', $




WebFOCUS 8.2.06
SQL Server
HTML, PDF, Excel, etc
August 04, 2020, 07:21 PM
Waz
Is TEST_FIL in a define ?, if so, its needs to be NOPRINTed in the TABLE request


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!

August 04, 2020, 10:23 PM
AMC2
Yes, it is in a DEFINE and it is a NOPRINT in the final TABLE request. I amended the test selection in the DEFINE however....but the images are still coming out broken for now.


WebFOCUS 8.2.06
SQL Server
HTML, PDF, Excel, etc
August 04, 2020, 10:43 PM
Waz
What is the URL generated ? and what is the format of the output ?


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!

August 04, 2020, 11:16 PM
AMC2
URL....'

The output format is HTML.


WebFOCUS 8.2.06
SQL Server
HTML, PDF, Excel, etc
August 04, 2020, 11:18 PM
AMC2
THEN '' ELSE '';


WebFOCUS 8.2.06
SQL Server
HTML, PDF, Excel, etc
August 04, 2020, 11:37 PM
Waz
Are you setting the image to a run command ?

Can you post the fex or the part of the fex with the define, table with style ?

Use the code tags. they are above in Red


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!

August 04, 2020, 11:59 PM
AMC2
Here is the DEFINE, the last TABLE request, and the styling section:

  
DEFINE FILE HLD_VBP_DATA
TEST_FIL/A3 = IF ROW_LBL EQ 'Select Provider Plus 5%' AND AMT_FIELD EQ '5%' OR 
                 ROW_LBL EQ 'Select Provider Plus 10%' AND AMT_FIELD EQ '10%' OR
				 ROW_LBL EQ 'Select Provider Plus 15%' AND AMT_FIELD EQ '15%' OR
                 ROW_LBL EQ 'Select Provider Plus 20%' AND AMT_FIELD EQ '20%' OR
                 ROW_LBL EQ 'Select Provider Plus 25%' AND AMT_FIELD EQ '25%' OR
                 ROW_LBL EQ 'Select Provider Plus 30%' AND AMT_FIELD EQ '30%'
               THEN 'YES' ELSE 'NOP';

-*TEST_FIL/A3 = IF AMT_FIELD EQ '5%' OR '10%' OR '15%' OR '20%' OR '25%' OR '30%'
-*                THEN 'YES' ELSE 'NOP';
END

TABLE FILE HLD_VBP_DATA
SUM MAX.AMT_FIELD
BY RPT_GRP NOPRINT
BY SORT_ROW NOPRINT
BY ROW_LBL AS ''
BY TEST_FIL NOPRINT
ACROSS CLDR_DT AS ''
ON RPT_GRP SKIP-LINE
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET PAGE-NUM NOPAGE
ON TABLE SET AUTOFIT ON
ON TABLE SET TITLELINE ON
-*ON TABLE SET SPACES 1
-*ON TABLE SET STYLEMODE FIXED
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *

TYPE=REPORT,
	CSSURL=IBFS:/WFC/Repository/PMR/common/css/PMR_com_css_main_css.css,
$
TYPE=REPORT,
	 GRID=OFF ,
     FONT='OpenSans',
     SIZE=12,
	 STYLE=NORMAL,
	 COLOR=RGB(76 76 76),
	 SQUEEZE=ON,
-*	 WIDTH=3.0,
	 JUSTIFY=CENTER,
-*	 LEFTGAP=1.5,
-*	 RIGHTGAP=1.5,
$

-*TYPE=HEADING, HEADALIGN=BODY, $
-*TYPE=HEADING, COLSPAN=12, $

TYPE=ACROSSVALUE, STYLE=BOLD, $
TYPE=DATA, ACROSSCOLUMN=MAX.AMT_FIELD, STYLE=BOLD, WHEN=ROW_LBL EQ ' ', $

-* style Potential using bottom border
TYPE=DATA, COLUMN=ROW_LBL, BORDER-BOTTOM=LIGHT, WHEN=ROW_LBL='Potential', $
TYPE=DATA, ACROSSCOLUMN=MAX.AMT_FIELD, BORDER-BOTTOM=LIGHT, WHEN=ROW_LBL EQ 'Potential', $


-* style Estimated using top border
TYPE=DATA, COLUMN=ROW_LBL, BORDER-TOP=LIGHT, WHEN=ROW_LBL='Estimated', $
TYPE=DATA, ACROSSCOLUMN=MAX.AMT_FIELD, BORDER-TOP=LIGHT, WHEN=ROW_LBL EQ 'Estimated', $

-*TYPE=DATA, ACROSSCOLUMN=MAX.AMT_FIELD, COLOR=GREEN, WHEN=ROW_LBL='&|#x2714;&|#xfe0f;', $


TYPE=DATA, ACROSSCOLUMN=MAX.AMT_FIELD, IMAGE=streamline_icon_check_circle_25px.png, WHEN=TEST_FIL EQ 'YES', $
-*TYPE=DATA, ACROSSCOLUMN=MAX.AMT_FIELD, IMAGE=streamline_icon_check_circle_25px.png, WHEN=ROW_LBL EQ 'Select Provider Plus 10%', $
-*TYPE=DATA, ACROSSCOLUMN=MAX.AMT_FIELD, IMAGE=streamline_icon_check_circle_25px.png, WHEN=ROW_LBL EQ 'Select Provider Plus 15%', $
-*TYPE=DATA, ACROSSCOLUMN=MAX.AMT_FIELD, IMAGE=streamline_icon_check_circle_25px.png, WHEN=ROW_LBL EQ 'Select Provider Plus 20%', $
-*TYPE=DATA, ACROSSCOLUMN=MAX.AMT_FIELD, IMAGE=streamline_icon_check_circle_25px.png, WHEN=ROW_LBL EQ 'Select Provider Plus 25%', $
-*TYPE=DATA, ACROSSCOLUMN=MAX.AMT_FIELD, IMAGE=streamline_icon_check_circle_25px.png, WHEN=ROW_LBL EQ 'Select Provider Plus 30%', $

-*OR 'Select Provider Plus 15%' OR 'Select Provider Plus 20%' OR 'Select Provider Plus 25%' OR 'Select Provider Plus 30%',
-*JUSTIFY=LEFT,
$

ENDSTYLE
END



WebFOCUS 8.2.06
SQL Server
HTML, PDF, Excel, etc
August 05, 2020, 01:41 AM
Waz
Where are you images ?
I think they need to be IMAGE=IBFS:/WFC/.../streamline_icon_check_circle_25px.png if they are in the repository


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!

August 05, 2020, 10:44 AM
AMC2
They are in the repository.

I can't get this to work at all in the TYPE styling.... IMAGE=IBFS:/WFC/Repository/PMR/common/images/streamline_icon_check_circle_25px.png.

What's odd is that if I have this DEFINE field with the filter and just IMAGE=streamline_icon_check_circle_25px.png in the styling , it shows the images:
   
TEST_FIL/A3 = IF ROW_LBL EQ 'Select Provider Plus 5%' OR 'Select Provider Plus 10%' OR 'Select Provider Plus 15%' OR 'Select Provider Plus 20%' OR 'Select Provider Plus 25%' OR 'Select Provider Plus 30%' 
THEN 'YES' ELSE 'NOP';


However, I am not getting the images in the correct places on the output of the report for some records with this filter.


But if I have this particular DEFINE field with this filter with just IMAGE=Image Name in the styling, it does not show the images:

  
TEST_FIL/A3 = IF ROW_LBL EQ 'Select Provider Plus 5%' AND AMT_FIELD EQ '5%' OR 
                 ROW_LBL EQ 'Select Provider Plus 10%' AND AMT_FIELD EQ '10%' OR
				 ROW_LBL EQ 'Select Provider Plus 15%' AND AMT_FIELD EQ '15%' OR
                 ROW_LBL EQ 'Select Provider Plus 20%' AND AMT_FIELD EQ '20%' OR
                 ROW_LBL EQ 'Select Provider Plus 25%' AND AMT_FIELD EQ '25%' OR
                 ROW_LBL EQ 'Select Provider Plus 30%' AND AMT_FIELD EQ '30%'
               THEN 'YES' ELSE 'NOP';



Also, this is the COMPUTE with the URL link I am using:
  
SUM COMPUTE CHK/A20 = IF (VBR_PRCG_SCHD_NM EQ 'Select Provider Plus 5%' OR 'Select Provider Plus 10%' OR 'Select Provider Plus 15%' OR 'Select Provider Plus 20%' OR 'Select Provider Plus 25%' OR 'Select Provider Plus 30%')
                        THEN '<img src="/ibi_apps/run.bip?BIP_REQUEST_TYPE=BIP_LAUNCH&|BIP_folder=IBFS:/WFC/Repository/PMR/common/images|BIP_item=/streamline_icon_check_circle_25px.png">' ELSE '';


Also, the CHK compute field is manipulated into the AMT_FIELD....which is why the stylying uses the AMT_FIELD.


WebFOCUS 8.2.06
SQL Server
HTML, PDF, Excel, etc
August 05, 2020, 03:56 PM
Waz
This could be due to the across you are using.

Can you replicate this with one of the sample files like CAR ?


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!

August 26, 2020, 10:28 AM
AMC2
Can I reopen this discussion?

If I generate the checkmark with a Unicode character using this COMPUTE below instead, it works:

 
COMPUTE CHK/A20 = IF (VBR_PRCG_SCHD_NM EQ 'Select Provider Plus 5%' OR 'Select Provider Plus 10%' OR 'Select Provider Plus 15%' OR 'Select Provider Plus 20%' OR 'Select Provider Plus 25%' OR 'Select Provider Plus 30%')
                   THEN '&|#x2714;&|#xfe0f;' ELSE '';
 




WebFOCUS 8.2.06
SQL Server
HTML, PDF, Excel, etc
August 26, 2020, 10:33 AM
AMC2
Using the Unicode character it generates the checkmarks on the correct records for the report. However, I need to use the image file itself to generate the checkmark because I am including this in a PDF layout. Unicode characters will not display correctly in the PDF layout.


WebFOCUS 8.2.06
SQL Server
HTML, PDF, Excel, etc