Hi There, I am new to Active Choices plugin and I am currently using an Active Choices Reactive Reference Parameter (from Active Choices plugin) in a declarative pipeline script. Reacting to a parameter called Build_Type and creates a HTML textarea field. Here is the code.
if ( Build_Type.equals('Module_Bind') ) {
return "<textarea id='Module_List' class='setting-input' name='value' rows='10' cols='50' placeholder='Enter module list, each on a new line' ></textarea>"
}
Textarea field is displayed properly during the build and I am able to enter the multiple values/rows in the Textarea field. However, I am receiving the value with “\n”. I have tried to split and display the values using below groovy code.
echo Build_Type
echo Module_List
def a = Module_List.toString()
a = a.replaceAll("\n", "#")
echo Build_Type + ":" + a + ":" + a.length()
def b = a.split('\n')
echo Build_Type + ":" + b + b.size()
But the value is not splitting based on “\n”.
Sample Data: when I enter “AAA” and “BBB” in two lines in the Module_List field, getting the value like below in groovy after each echo statement.
[Pipeline] echo
Module_Bind
[Pipeline] echo
AAA\nBBB,
[Pipeline] echo
Module_Bind:AAA\nBBB,:9
[Pipeline] echo
Module_Bind:[AAA\nBBB,]1
I want to split “AAA\nBBB,” value based on “\n”. Could you please assist me in this regard.
Thanks,
Sati