private String getFunctionTemplate ( GroupCache gc , FunctionBandElement fbe , boolean previous ) throws QueryException { StringBuilder templateKey = new StringBuilder ( ) ; if ( gc == null ) { // function in Header templateKey . append ( "F_" ) . append ( fbe . getFunction ( ) ) . append ( "_" ) . append ( fbe . getColumn ( ) ) ; return templateKey . toString ( ) ; } // function in group header String groupColumn = gc . getGroup ( ) . getColumn ( ) ; Object groupValue ; if ( previous ) { if ( resultSetRow == 0 ) { groupValue = getResult ( ) . nextValue ( groupColumn ) ; } else { groupValue = previousRow [ getResult ( ) . getColumnIndex ( groupColumn ) ] ; } } else { groupValue = getResult ( ) . nextValue ( groupColumn ) ; } // keep the current value of the group groupTemplateKeys . put ( "G" + gc . getGroup ( ) . getName ( ) , "G" + gc . getGroup ( ) . getName ( ) + "_" + previousRow [ getResult ( ) . getColumnIndex ( groupColumn ) ] ) ; templateKey . append ( "G" ) . append ( gc . getGroup ( ) . getName ( ) ) . append ( "_F_" ) . append ( fbe . getFunction ( ) ) . append ( "_" ) . append ( fbe . getColumn ( ) ) . append ( "_" ) . append ( groupValue ) ; int group = Integer . parseInt ( gc . getGroup ( ) . getName ( ) ) ; StringBuilder result = new StringBuilder ( ) ; for ( int i = 1 ; i < group ; i ++ ) { result . append ( groupTemplateKeys . get ( "G" + i ) ) . append ( "_" ) ; } result . append ( templateKey . toString ( ) ) ; return result . toString ( ) ; }
string template used by functions in header and group header bands