I have a lot of different templates defined in my TTCN-3 code. For simplicity let's focus on the example below:
type record Action {
charstring name,
charstring param optional,
charstring state optional
}
template Action actionTemplate(param := *, state := *) {
name := "Template",
param := param,
state := state
}
var Action actOne := {"Name", omit, "OK"};
template Action actTwo := actionTemplate(state := "NOT OK");
Is there a possibility to iterate over the actTwo fields, check if there is a value set and update the corresponding field in actOne? I'd like to do this in a generic way, because I don't always know the exact structure of template's subfields.
Is there a possibility to iterate over template fields like iterate over e.g. dict in Python where we have keys and corresponding values?
You may apply the TTCN-3 extension Advanced Parameterization and implement a generic function that checks the template fields and may assign values to the variable.
In order to get more ideas please share your question with the TTCN-3 linkedIn group or in the forum.