Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel
borderColorpurple
bgColorwhite
titleColorblack
borderWidth1
titleBGColor#ddccff
borderStylesolid
titleNew feature

This is a new feature in Joget DX 8


Table of Contents

Introduction

BeanShell Display Column allows BeanShell integration in a List, which allows you to write custom Java code to create custom displays.

Where to Find

Figure 1: BeanShell Display Column element listed under the Display Column section as "BeanShell".

It can be found labelled as "BeanShell" under the Display Column section in the List Builder. You may also find it using the Search Palette by keying in "BeanShell".

Warning
titleWarning

Not to be confused with BeanShell Action.

Usage

Simply drag and drop the element into the List. Remember to Save your work by clicking on the blue glowing "Save" button on the upper right corner.

Figure 2: Adding a BeanShell Display Column to a List.

Figure 3: BeanShell Display Column properties.

Name

Description

Label

Custom label for the BeanShell Display Column element.

Default value: "BeanShell".

IDID of the BeanShell Display Column element.
Script

Custom script in Java.

Input and Corresponding Result For Reference

Sample 1: Display Custom String

Figure 4: Example input 1 in the Script property.

Figure 5: Result from example input 1 shown in Figure 4.


List of Injected Variables Used for Samples 2 and 3:

  • BeanShellColumn column
  • DataList datalist
  • Object row
  • int index

Sample 2: Display Number Row in Roman Numerals

Figure 6:  Example input 2 in the Script property.

Code Block
languagejava
titleCode Block
int decimalNumber = index + 1;

int[] values = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
String[] romanLetters = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};

StringBuilder romanNumber = new StringBuilder();

for(int i = 0; i < values.length; i++){  
    while(decimalNumber >= values[i]){
        decimalNumber = decimalNumber - values[i];
        romanNumber.append(romanLetters[i]);
    }
}

return romanNumber;

Figure 7: Result from example input 2 shown in Figure 6.

Sample 3: Display Number Row with Conditional Prefix

Figure 8: Example input 3 in the Script property.

Code Block
languagejava
titleCode Block
int rowNumber = index + 1;

int determinant = rowNumber % 2;

if (determinant == 0){
    return "Even " + rowNumber;
}
else if (determinant != 0){
    return "Odd " + rowNumber;
}
else{
    return "Error";
}

Figure 9: Result from example input 3 shown in Figure 8.