Xporter allows rendering test based on JavaScript. The notation is:
%{<Javascript>} |
Examples:
Output the current date Expand source
%{( new Date()).getDate() + "/" + (( new Date()).getMonth()+ 1 ) + "/" + ( new Date()).getFullYear()}
Format the Creation Date in the dd-MM-yyyy HH:mm format (01-03-1978 8:00) Expand source
%{var dateTime = '${dateformat("dd-MM-yyyy HH:mm:ss"):Created}'.split( ' ' ); var date = dateTime[ 0 ]; var time = dateTime[ 1 ]; var dateParts = date.split( '-' ); var timeParts = time.split( ':' ); dateParts[ 2 ] + '-' + dateParts[ 1 ] + '-' + dateParts[ 0 ] + ' ' + timeParts[ 0 ] + ':' + timeParts[ 1 ]}
Format the Creation Date in the dd-MM-yyyy format (03-01-1978) Expand source
%{'${dateformat("dd-MM-yyyy HH:mm:ss"):Created}'.substring( 0 , 10 )}
Format the Creation Date in the MMM d yyyy format (Jan 3, 1978) Expand source
%{var months = new Array( 'Jan' , 'Feb' , 'Mar' , 'Apr' , 'May' , 'Jun' , 'Jul' , 'Aug' , 'Sep' , 'Oct' , 'Nov' , 'Dec' ); var dateParts = '${dateformat(“d-MM-yyyy HH:mm:ss”):Created}'.split( '-' ); var month = dateParts[ 1 ]; var day = dateParts[ 0 ] ; var year = dateParts[ 2 ].split( ' ' )[ 0 ]; months[Number(month) - 1 ] + ' ' + day + ', ' + year;}
Export the content if the field is not empty; otherwise, display other text Expand source
%{( '${Focus}' .length > 0 ) ? 'Focus: ${Focus}' : 'Focus not Available' }