ucColumnReportInit

Purpose

This method is called when you execute a column report. The method is used to initialize any user custom code you require for the report

Applies To

Search & Reporting screens

Signature

public void ucColumnReportInit()

Notes

The method is also called when the user refreshes a report

Example

public HashMap ucModifyColumnReportRow (HashMap tags)
throws Exception
{
    // Check the report output type: only implement custom color coding scheme if
    // output type if HTML (not for Word or Excel)
    SesameSession session = SesameSession.getSession();
    String outputType = (String) session.getAttribute("REPORT_OUTPUTTYPE");
    
    if ( ! "HTML".equalsIgnoreCase(outputType) ) { return tags; }
    
    // Resource Interactive CUSTOM CODE:
    // Set the color code according to the issue priority:
    String priority = (String) tags.get("PRIORITY");
    
    if (priority != null)
    {
        String fontColor = null;
        
        if ( priority.equals("Monday") ) {
            fontColor = "#FF0000";
        } else if ( priority.equals("Tuesday") ) {
            fontColor = "#CF2904";
        } else if ( priority.equals("Wednesday") ) {
            fontColor = "#CF4E04";
        } else { // Friday or Thursday
            fontColor = "#000000";
        }
        
        // Iterate through all tag values and set their font color
        Set keys = tags.keySet();
        Iterator iterator = keys.iterator();

        while (iterator.hasNext() )
        {
            String key = (String) iterator.next();
            
            // Don't change special tags (i.e., $$ROWNUM_START$$, $$ROWNUM_SIZE$$)
            // NOTE: Noticed that if changing the ID value,
            // then an Exception is generated in the log file:
            
            if ( key.startsWith("$$") || key.equals("ID") ) {
                continue;
            }
            
            String value = (String) tags.get(key);
            tags.put(key, " < font color='" + fontColor + "' >" + value + "< /font>");
        }
    }
    
    return tags;
}