Hi All,
I am using the below Redwood script to update the parameter "DIRECT" of job definition "FILE_RENAME_PARAM". I am getting the parameter value from "PARAM_TRANSLATION" table. The column in the table is "TARGET". Can you please advise how can I change the below script to update the parameter "DIRECT" of ALL job definitions of type "CMD" using the below Redwood script.
{
JobDefinition jobDefinition = jcsSession.getJobDefinitionByName("FILE_RENAME_PARAM");
if (jobDefinition.getName().equals("FILE_RENAME_PARAM"))
{
JobDefinitionParameter parameterDIR = jobDefinition.getJobDefinitionParameterByName("DIRECT");
if (parameterDIR != null)
{
String defaultExpression = parameterDIR.getDefaultExpression();
if (defaultExpression != null)
{
Table table = jcsSession.getTableByName("PARAM_TRANSLATION");
if (table != null)
{
TableValue tableValue = table.getTableValueBySearchKeySearchColumnName(defaultExpression, "TARGET");
String targetInstance = null;
if (tableValue != null)
{
targetInstance = table.getTableValueBySearchKeySearchColumnName(defaultExpression, "TARGET").getColumnValue();
jcsOut.println(targetInstance);
parameterDIR.setDefaultExpression(targetInstance);
jcsSession.persist();
}
else
{
throw new Exception("Key " + defaultExpression + " (from job definition " + jobDefinition.getName() + ") was not found in table PARAM_TRANSLATION");
}
}
}
}
}
}
Thank you so much in advance.
Regards,
Ramana