Sharon_ Posted October 28, 2009 Report Share Posted October 28, 2009 Hi, When we connect enum or ring(with items 0,1,2,3,4,5..) with case structure, the case structure shows only 2 cases - default value and one more. Is it possible to display all the cases, when the cases are connected to the structure. The problem is, I want to do this programatically using VI scripting and I dont know which property to change.. Please help..!!!! Thanks in advance....!!!! -Sharon case.vi Quote Link to comment
ShaunR Posted October 28, 2009 Report Share Posted October 28, 2009 If you use an enum (your example uses a ring) then when you right click on the case there is a menu option to "Add Case For Every Value". I havn't looked, but there is probably a property or invoke node that enables you to do this in scripting. Quote Link to comment
Rolf Kalbermatter Posted October 28, 2009 Report Share Posted October 28, 2009 Hi, When we connect enum or ring(with items 0,1,2,3,4,5..) with case structure, the case structure shows only 2 cases - default value and one more. Is it possible to display all the cases, when the cases are connected to the structure. The problem is, I want to do this programatically using VI scripting and I dont know which property to change.. A ring control only is a number. Its datatype does not contain any information as to how many elements the Ring Control contains, since that can be changed at runtime through one of its properties, while datatype information has to be defined at compile time. So there is no automatic way to have a case structure adapt to a Ring Control since there is nothing to adapt to, in comparison when you do the same with an enum. The scripting interface of the case structure should have a property that is an array of strings and that should allow to define the number of cases and their values. Quote Link to comment
Sharon_ Posted October 28, 2009 Author Report Share Posted October 28, 2009 A ring control only is a number. Its datatype does not contain any information as to how many elements the Ring Control contains, since that can be changed at runtime through one of its properties, while datatype information has to be defined at compile time. So there is no automatic way to have a case structure adapt to a Ring Control since there is nothing to adapt to, in comparison when you do the same with an enum. The scripting interface of the case structure should have a property that is an array of strings and that should allow to define the number of cases and their values. Hi, Manually it is okie . I can see the 'Add case for every value'. But while writing VI scripts I dont find any options like that. I have attached my VI along with this post for your ref. Could you pls tell me what is wrong with my VI..? Thanks for your time..!!! Sharoncase_enum.vi Quote Link to comment
Dan DeFriese Posted October 28, 2009 Report Share Posted October 28, 2009 Hi, Manually it is okie . I can see the 'Add case for every value'. But while writing VI scripts I dont find any options like that. I have attached my VI along with this post for your ref. Could you pls tell me what is wrong with my VI..? Thanks for your time..!!! Sharoncase_enum.vi To create a case for every value you can: 1) remove empty cases (you now have one case) 2) use the (size of the enum strings - 1) to determine how many new frame to add. Note: I changed the example to create a new VI instead of open an existing one since I don't know the context of your use case. hope this helps case_enum.vi Quote Link to comment
Rolf Kalbermatter Posted October 28, 2009 Report Share Posted October 28, 2009 Hi, Manually it is okie . I can see the 'Add case for every value'. But while writing VI scripts I dont find any options like that. I have attached my VI along with this post for your ref. Could you pls tell me what is wrong with my VI..? Thanks for your time..!!! Sharoncase_enum.vi Look for the property FrameNames of the CaseSel class. This is an array of strings much like the Strings[] property for enums. Quote Link to comment
ShaunR Posted October 28, 2009 Report Share Posted October 28, 2009 Look for the property FrameNames of the CaseSel class. This is an array of strings much like the Strings[] property for enums. OK. I've looked now Its a little bit more complicated than that, since the frame names has to match the number of cases. If you just wire it to an array of strings, you will get an error and only 2 cases will have the names. You have to create the correct number of cases (array length - 2) using the "add frame" invoke node then wire your string array to it. Quote Link to comment
Sharon_ Posted October 29, 2009 Author Report Share Posted October 29, 2009 To create a case for every value you can: 1) remove empty cases (you now have one case) 2) use the (size of the enum strings - 1) to determine how many new frame to add. Note: I changed the example to create a new VI instead of open an existing one since I don't know the context of your use case. hope this helps Thank you very much Dan, rolfk and Shaun . You people are really great and this forum really rocks..!!! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.