Pictogram Technique



Pictogram Technique

By Dan Grady Strategic Engineering Product Leader
Information Builders

A pictogram is a bar chart that uses pictures to represent data rather than bars. The report looks something like this.

 

This pictogram represents the number of units each city has in stock. As referenced in the footing of the report, each of the TV icons represents 200,000 units. This is a summary report meant to quickly depict information – so the numbers will be rounded slightly – but the same information is presented.

Now let’s start discussing how to produce this report.

Examining the FOCEXEC

Most developers are familiar with how to add a gif to a report. To create the pictogram, add multiple instances of the same gif to represent a certain section of the data. To do this, create the HTML code in either a DEFINE or a COMPUTE. For the pictogram we are going to use a series of COMPUTEs – 16, to be exact.

The FOCEXEC starts off as all FOCEXECs do.

				SET PAGE-NUM=NOLEAD
TABLE FILE CENTORD
SUM
   QUANTITY NOPRINT

Now to start our series of COMPUTEs. The first one is going to determine how many images are going to be displayed for each of the Dimensions.

				COMPUTE CQUANT/D12.1 = QUANTITY / 200000; NOPRINT

Here we create CQUANT and divide our actual Quantity value by the number we want each image to represent. Then, of course, we need to NOPRINT this.

Now we need to write out the images. The number of images is equal to the value of CQUANT. Plus, we’ve also accounted for the placement of a half an image. The FOCEXEC is prepared to handle up to 15 images for each Dimension. I don’t think you will need more than that for a summary report, but if you do, you will see the pattern. It is recommended that you increase the divisor rather than increase the number of images. Let’s look at how we do this.

				COMPUTE ORD1/A200 = IF CQUANT LT .5 THEN '' 
ELSE IF CQUANT GE .5 AND CQUANT LT 1 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 1 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">' AS ‘’

So now we have a value of CQUANT that ranges from 1 to 15. Next, check whether the value is less then .5: if that is true, don’t display an image; if it the value falls between .5 and 1, display half an image; and if it greater than 1, we need a whole image. Since we are doing a COMPUTE, this will take place for each of the BY fields. Repeat this COMPUTE 15 times and you’ll notice that each one is printed without a title to provide the illusion that it is one field.

You’ll notice that the images use a relative path. It is important to set up a BASEURL in your edasprof.prf.

The complete FOCEXEC can be seen below. (I’m eliminating the stylesheet section.)

The FOCEXEC
SET PAGE-NUM=NOLEAD
TABLE FILE CENTORD
SUM
   QUANTITY NOPRINT

COMPUTE CQUANT/D12.1 = QUANTITY / 200000; NOPRINT

COMPUTE ORD1/A200 = IF CQUANT LT .5 THEN '' 
ELSE IF CQUANT GE .5 AND CQUANT LT 1 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 1 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">';
AS ' '

COMPUTE ORD2/A200 = IF CQUANT LT 1.5 THEN '' 
ELSE IF CQUANT GE 1.5 AND CQUANT LT 2 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 2 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">';
AS ' '

COMPUTE ORD3/A200 = IF CQUANT LT 2.5 THEN '' 
ELSE IF CQUANT GE 2.5 AND CQUANT LT 3 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 3 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">';
AS ' '

COMPUTE ORD4/A200 = IF CQUANT LT 3.5 THEN '' 
ELSE IF CQUANT GE 3.5 AND CQUANT LT 4 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 4 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">';
AS ' '

COMPUTE ORD5/A200 = IF CQUANT LT 4.5 THEN '' 
ELSE IF CQUANT GE 4.5 AND CQUANT LT 5 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 5 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">';
AS ' '

COMPUTE ORD6/A200 = IF CQUANT LT 5.5 THEN '' 
ELSE IF CQUANT GE 5.5 AND CQUANT LT 6 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 6 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">';
AS ' '

COMPUTE ORD7/A200 = IF CQUANT LT 6.5 THEN '' 
ELSE IF CQUANT GE 6.5 AND CQUANT LT 7 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 7 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">';
AS ' '

COMPUTE ORD8/A200 = IF CQUANT LT 7.5 THEN '' 
ELSE IF CQUANT GE 7.5 AND CQUANT LT 8 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 8 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">';
AS ' '

COMPUTE ORD9/A200 = IF CQUANT LT 8.5 THEN '' 
ELSE IF CQUANT GE 8.5 AND CQUANT LT 9 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 9 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">';
AS ' '

COMPUTE ORD10/A200 = IF CQUANT LT 9.5 THEN '' 
ELSE IF CQUANT GE 9.5 AND CQUANT LT 10 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 10 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">';
AS ' '

COMPUTE ORD11/A200 = IF CQUANT LT 10.5 THEN '' 
ELSE IF CQUANT GE 10.5 AND CQUANT LT 11 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 11 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">';
AS ' '

COMPUTE ORD12/A200 = IF CQUANT LT 11.5 THEN '' 
ELSE IF CQUANT GE 11.5 AND CQUANT LT 12 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 12 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">';
AS ' '

COMPUTE ORD13/A200 = IF CQUANT LT 12.5 THEN '' 
ELSE IF CQUANT GE 12.5 AND CQUANT LT 13 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 13 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">';
AS ' '

COMPUTE ORD14/A200 = IF CQUANT LT 13.5 THEN '' 
ELSE IF CQUANT GE 13.5 AND CQUANT LT 14 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 14 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">';
AS ' '


COMPUTE ORD15/A200 = IF CQUANT LT 14.5 THEN '' 
ELSE IF CQUANT GE 14.5 AND CQUANT LT 15 THEN 
'<img src="/ibi_html/ibicc/images/smvid2.gif">' 
ELSE IF CQUANT GE 15 THEN 
'<img src="/ibi_html/ibicc/images/smvid.gif">';
AS ' '
BY
   PLANTLNG AS 'City'
HEADING
"Pictogram"
"as of <+0>&DATEtMDYY <+0> "
FOOTING
"* Each TV equals 200000 units"
ON TABLE NOTOTAL
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET HTMLCSS ON
END