Monthly Archives: May 2008

How to Generate a GUID in an XAction

I needed to uniquely identify a request to Pentaho (one particular action sequence request). Found a pretty darn easy way to do this with the help from Java RMI classes.

– Insert a Javascript data source

200805011651

– Enter the following script

function getGUID() {
var VMID = new Packages.java.rmi.dgc.VMID();
return VMID.toString();
}
getGUID();

– Set return type as “string” for a new value

200805011650-1

– Add it to your response

200805011652

200805011653

– Enjoy your GUIDs!
cef9372c035a42ed:-b0917ee:119a6d47d72:-7ff4
cef9372c035a42ed:-b0917ee:119a6d47d72:-7ff3
cef9372c035a42ed:-b0917ee:119a6d47d72:-7ff2

PS – I personally hate GUIDs when stored in the database. 🙂 However, for matching up with a particular request, yippeee!!