Hello,
I am developing a urcap and I have the following error:
I would like to create a variable in the urcap and assign this variable to a String value that is going to read it from another device,
I could create the variable, set the variable and get selected variable using the following functions:
public Variable getSelectedVariable(){
return model.get(KEY_REPLY_FROM_SERVER, (Variable)null);
}
public void setVariable(final Variable variable){
undoRedoManager.recordChanges(new UndoableChanges() {
@Override
public void executeChanges() {
model.set(KEY_REPLY_FROM_SERVER, variable);
}
});
}
public GlobalVariable createGlobalVariable(String variableName){
GlobalVariable variable = null;
try {
variable = variableFactory.createGlobalVariable(variableName, programAPI.getValueFactoryProvider().createExpressionBuilder().append("0").build());
} catch (VariableException variableException) {
System.out.println("Could not crerate the variable. ERROR " + variableException);
variableException.printStackTrace();
} catch (InvalidExpressionException e) {
e.printStackTrace();
}
return variable;
}
public void generateScript(ScriptWriter writer) {
Variable errorReset = getSelectedVariable();
if (errorReset != null) {
String errorVariableStringValue = writer.getResolvedVariableName(errorReset);
//errorVariableStringValue.toString();
writer.appendLine(errorVariableStringValue + “=” +“"” + “SHOULD BE STRING NOT INT” + “"”);
}
and everything is working well if I assign the variable to an integer value, but I need to assign this variable to a string value…
do you have any proposal.?
Best Regards.