diff --git a/config/tool_conf.xml.sample b/config/tool_conf.xml.sample index f77edc40d82..aeb42d29f3b 100644 --- a/config/tool_conf.xml.sample +++ b/config/tool_conf.xml.sample @@ -42,6 +42,9 @@ +
+ +
diff --git a/tools/expression_tools/parse_values_from_file.xml b/tools/expression_tools/parse_values_from_file.xml new file mode 100644 index 00000000000..12f52d72451 --- /dev/null +++ b/tools/expression_tools/parse_values_from_file.xml @@ -0,0 +1,106 @@ + + from dataset + { +var output; +if ($job.remove_newlines || $job.param_type != 'string') { + $job.input1.contents = $job.input1.contents.trim(); +} +if ($job.param_type == 'integer') { + output = parseInt($job.input1.contents); +} else if ($job.param_type == 'float') { + output = parseFloat($job.input1.contents); +} else if ($job.param_type == 'boolean') { + const trueValues = ['yes', 'true', '1'] + const falseValues = ['no', 'false', '0'] + let lowerCaseContents = $job.input1.contents.toLowerCase(); + if (trueValues.includes(lowerCaseContents)) { + output = true; + } else if (falseValues.includes(lowerCaseContents)) { + output = false; + } + else { + return 'NOT A BOOLEAN VALUE'; + } +} else { + output = $job.input1.contents; +} +return {'output': output}; + } + + + + + + + + + + + + + param_type == 'string' + + + param_type == 'integer' + + + param_type == 'float' + + + param_type == 'boolean' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +