Problem beanshell with dynamic variable

Confluence User - 11 Feb, 2020

Hi,

I have problem to execute hash variable with dynamic parameter

if hashvariable direct value is no problem

String level = "#pl.employee.employeecode.88888.level#"; 

output

I need to dynamic employeeCode into hashvariable 

String emplCode = User.getEmployeeCode();
String level = "#pl.employee.employeecode."+emplCode+".level#";

but i have a problem

output


thanks in advance

best regard

Khafidz

hashvariable;beanshell

6


12 Feb, 2020
confluenceUser
confluenceUser

I am afraid you cannot split a hash string into two or more parts, Joget hash variables is like a search and replace string function in a text editor. It will find the matching #somehashstring# and replace with the new value.

Try this instead ( in pseudocode ):

  • Assign #pl.employee.employeecode.88888.level# to string var0
  • split value in var0 into var1 and var2
  • perform your string concat var1 + empcode + var2



12 Feb, 2020
confluenceUser
confluenceUser

Hi, you can try using a nested hash variable Hash Variable#NestedHashVariable

13 Feb, 2020
confluenceUser
confluenceUser

thank you Anders, but still not work

13 Feb, 2020
confluenceUser
confluenceUser

thank you Mattew, i have split hash variable like pseudocode 

but it still not work.

i try hashvariable to reproccess

it work,


13 Feb, 2020
confluenceUser
confluenceUser

According to the examples in the documentation, I do not think you can use the + symbol.

14 Feb, 2020
confluenceUser
confluenceUser

The hash variable is only parsed one time. You cannot have it parsed the second time.

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print