This post is more than 5 years old
11 Posts
0
904
How to define a Set structure attribute in dynamic model
Hi
How to define a Set structure attribute in the dynamic model.
In the documentation, it just point out attribute's type is limited to basic type such as string,int... How can i define a set structure which contains string for a attribute in mdl files.
BRs
David Wang
wangw98
11 Posts
0
January 11th, 2012 00:00
Define the attribute as table just like this:
table attributename string;
it will be constructed as MR_IS_SET.
Christian4
30 Posts
0
January 18th, 2012 01:00
Hello David
You can do it as follow:
defintion of the enum:
enum state_e { UNKNOWN=1,UP=2,DOWN=3};
using of the enum:
attribute state_e SC_ccmStatusThr "The value it has to match to fire an event." = DOWN;
It is also possible to change from integer to a string with this enum.
computed attribute state_e SC_ccmStatus "Convert to string." = state_e(SC_ccmStatusInt) else UNKNOWN;
Regards,
Christian