Search code examples
webspherewsadminjacl

how to get value of variable in jacl scripting language for IBM WebSphere Plugin Custom Properities?


I used the below code to get input from the user using jacl scripting language

set pname [gets stdin]
$AdminConfig create Property $pluginname {{validationExpression ""} {name $pname} {description ""} {value "30000"} {required "false"}}

I can't able to get a value of variable {name $pname}. I shows the error as attribute name is invalid.. Thanks in advance


Solution

  • Since braces prevent substitution, you could do:

    $AdminConfig create Property $pluginname [list {validationExpression ""} "name $pname" {description ""} {value "30000"} {required "false"}]
    

    I think an easier pattern to remember is the one you'll see here

    set attr_name           [list name $pName] 
    set attr_value          [list value 30000] 
    set attr_required       [list required false] 
    set attr_description    [list description ""]
    
    set attrs [list $attr_name $attr_value $attr_required $attr_description]
    
    $AdminConfig create Property $pluginname $attrs