Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
English |
---|
You have a requirement where a |
...
List needs to return a specific status based on the value of a column. In this case, we want to return the status "Expired" or "Active" based on the date value in the |
...
List compared to the actual date. |
...
list column where you want to return the status and select Bean Shell Formatter to enter the code below(Refer to Figure 2). |
Figure 1
Figure 2
Code Sample 1:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); try { Date date = formatter.parse(value); Calendar cal = Calendar.getInstance(); if (date.before(cal.getTime())) { return "Expired"; } else { return "Active"; } } catch (ParseException e) { e.printStackTrace(); } |
...