fbrandeber Posted August 25, 2006 Report Share Posted August 25, 2006 Hello, I have a situation where the user needs to input a unit number to each of 5 devices. Unit numbers can be 0-15. I need to warn/block duplicate number entries. Any suggestions or comments appreciated. newbie, Fred LV8 Quote Link to comment
crelf Posted August 25, 2006 Report Share Posted August 25, 2006 Try this out: Download File:post-181-1156544139.vi Quote Link to comment
Khalid Posted August 25, 2006 Report Share Posted August 25, 2006 Nice implementation crelf. Since Fred said the valid values are from 0-15, simply changing the constant (initial) value going into the shift-register from 0, to say 16 (or any value outside of 0-15) will do the trick. Of course, you will have to change the 'minmum' on the Device Numbers control to 0 (from 1). -Khalid Quote Link to comment
crelf Posted August 26, 2006 Report Share Posted August 26, 2006 Nice implementation crelf. Since Fred said the valid values are from 0-15, simply changing the constant (initial) value going into the shift-register from 0, to say 16 (or any value outside of 0-15) will do the trick. Of course, you will have to change the 'minmum' on the Device Numbers control to 0 (from 1). -Khalid Oops - I gotta get better at reading my requirements / functional specification documents Quote Link to comment
Kevin Boronka Posted August 26, 2006 Report Share Posted August 26, 2006 just a suggestion: You may want to move the popup message outside the loop. If you have two or more duplicates you will only have one warning message. Quote Link to comment
crelf Posted August 26, 2006 Report Share Posted August 26, 2006 just a suggestion:You may want to move the popup message outside the loop. If you have two or more duplicates you will only have one warning message. But you can't have more than one duplicate - as soon as a duplicate occurs, it will be detected and the arrays values will be set back to what they were before the duplicate existed. Quote Link to comment
Kevin Boronka Posted August 26, 2006 Report Share Posted August 26, 2006 But you can't have more than one duplicate - as soon as a duplicate occurs, it will be detected and the arrays values will be set back to what they were before the duplicate existed. that's true Quote Link to comment
fbrandeber Posted August 26, 2006 Report Share Posted August 26, 2006 that's true Not sure I understand all that, but I naturally changed the low number to 0 right away. The problem I am having is that I need to read that array periodically... I cannot seem to do that, seemingly because the only time the array is seen is when there is a value change.. So much for my specification document.. sigh... How do I handle that? Fred PS. I also hid the up/down buttons, to stop the frustration factor if a duplicate is in the way of the desired setting.. :-) Quote Link to comment
LAVA 1.0 Content Posted August 26, 2006 Report Share Posted August 26, 2006 The problem I am having is that I need to read that array periodically... What do you mean by this exactly. Where do you need to use the array? The best implementation always depends on the details Quote Link to comment
fbrandeber Posted August 27, 2006 Report Share Posted August 27, 2006 What do you mean by this exactly. Where do you need to use the array? The best implementation always depends on the details jimi, I read that array to determine the order and identity of 5 hardware data acquisition boxes via USB. I do this every few seconds. If I can read the array at will, I can handle the rest. Fred Quote Link to comment
Khalid Posted August 27, 2006 Report Share Posted August 27, 2006 jimi, I read that array to determine the order and identity of 5 hardware data acquisition boxes via USB. I do this every few seconds. If I can read the array at will, I can handle the rest. Fred Is there an initialization stage where the user enters these device IDs, and then from then on you check this array (which implies the user can't change it now)? Or, you would like to check the array all the time, even while the user is entering the device IDs? The devil is indeed in the details. -Khalid Quote Link to comment
fbrandeber Posted August 27, 2006 Report Share Posted August 27, 2006 Is there an initialization stage where the user enters these device IDs, and then from then on you check this array (which implies the user can't change it now)? YES, that is what I was trying to say... Still learning to communicate... Currently I have a "maintenance" section of the front panel with this in it. It will only get changed when a box or chassis changes... I am guessing I won't have any trouble getting this into my .exe, but have not tried yet. I have yet to seriously tackle the process of generating an .exe, with all its' details. My few trials, while successful, made it seem pretty non intuitive to me. Been focused on getting the program functional first. It is essentially a data logging application, catering to a special scenario. tnx, Fred Quote Link to comment
JDave Posted August 28, 2006 Author Report Share Posted August 28, 2006 jimi, I read that array to determine the order and identity of 5 hardware data acquisition boxes via USB. I do this every few seconds. If I can read the array at will, I can handle the rest. Fred The simplest way (if you want to read it any time) is to create a local variable of the array. (by right clicking on the control, choose 'Create', then Local Variable). Then you can right click and 'Change to Read'. Quote Link to comment
fbrandeber Posted August 28, 2006 Report Share Posted August 28, 2006 The simplest way (if you want to read it any time) is to create a local variable of the array. (by right clicking on the control, choose 'Create', then Local Variable). Then you can right click and 'Change to Read'. Interestingly, I had tried that, but because I had hidden the "index display", the option was greyed out, except at the very top edge of the object... sigh.. as I found out much later. Thanks for the encouragement! Fred Quote Link to comment
Michael Aivaliotis Posted August 28, 2006 Report Share Posted August 28, 2006 YES, that is what I was trying to say... Still learning to communicate...Currently I have a "maintenance" section of the front panel with this in it. It will only get changed when a box or chassis changes... I am guessing I won't have any trouble getting this into my .exe, but have not tried yet. I have yet to seriously tackle the process of generating an .exe, with all its' details. My few trials, while successful, made it seem pretty non intuitive to me. Been focused on getting the program functional first. It is essentially a data logging application, catering to a special scenario. tnx, Fred There's a lot going on here that perhaps you haven't considered. When your app is an exe, how will you store the settings so that they can be recalled later? You probably need to save them to a config file and then read them upon startup. Also, you need to decide on a storage mechanism of your variables that is internal to your program. You can use a local variable as stated to read the array but then how do you pass it throughout your app? Wires and shift registers come to mind but you might want to consider functional globals. Here is a link to a post I made way back that has a working example code of what you might want to do:http://forums.lavag.org/index.php?s=&s...post&p=8956 Notice that, once the configuration panel is closed, the configuration is available from anywhere in the program via the functional global. If you look inside the functional global you will see a state that handles saving of the configuration. Here is where you would implement your preffered method of configuration saving so oan executable can read it. This design pattern may seem trivial but it works. Quote Link to comment
fbrandeber Posted August 28, 2006 Report Share Posted August 28, 2006 There's a lot going on here that perhaps you haven't considered. When your app is an exe, how will you store the settings so that they can be recalled later? You probably need to save them to a config file and then read them upon startup. Also, you need to decide on a storage mechanism of your variables that is internal to your program. You can use a local variable as stated to read the array but then how do you pass it throughout your app? Wires and shift registers come to mind but you might want to consider functional globals. Here is a link to a post I made way back that has a working example code of what you might want to do:http://forums.lavag.org/index.php?s=&s...post&p=8956 Notice that, once the configuration panel is closed, the configuration is available from anywhere in the program via the functional global. If you look inside the functional global you will see a state that handles saving of the configuration. Here is where you would implement your preffered method of configuration saving so oan executable can read it. This design pattern may seem trivial but it works. Michael, You are correct, I had not considered that, thanks for the timely post! :-) Slowly I learn... Best regards, Fred 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.