How to get a substring from a Hash Variable

Confluence User - 08 Jul, 2017

Hello, Is there any way to get a substring using hash variable?

 

 

forms;value;hashvariable;hash

3


08 Jul, 2017
confluenceUser
confluenceUser

Hi Sebastian

You can use JS String.prototype.substring() to extract a substring from a hash variable or a Java beanshell.

10 Jul, 2017
confluenceUser
confluenceUser

Hi Andrew,

                 I'd just tried and I'm mising something in the writing. The next Hash Variable #form.0101_Solicitud.SubRubro# gives as result one string. How must I write the sentence in the hidden Field so as to get the first 3 chars from this string?

Thanks in advance.

Sebastian.

10 Jul, 2017
confluenceUser
confluenceUser

Hi Sebastian Alonsoabout

Kindly download and import this sample app into your Joget Workflow, will work in both community and enterprise version 5+.

The app has a form with example JS to substring the '#currentUser.username#' and '#date.EEEE, d MMMM yyyy' into 2 text field element. Works the same concept for form hash variable. Will also work on hidden fields too.

The JS/Jquery code in the form sits in the CustomHTML field element, as follows:

<script>
$(document).ready( function(){
var uName = '#currentUser.username#';
var subUname = uName.substring(2, 5);
$('#subUsername').val(subUname);
var uDate = '#date.EEEE, d MMMM yyyy#';
var subUdate = uDate.substring(16, 20);
$('#subDate').val(subUdate);
});
</script>

You can also use substring hash in beanshell using the Java syntax.

APP_substrhash-sample-app.jwa

 

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print