04-07-2023 07:52 AM
Hello,
I am new to labview and need advice on how I should proceed with this.
I based this VI of the tutorial VI on: https://forums.ni.com/t5/Example-Code/LabVIEW-Forms-Write-User-Data-to-Spreadsheet/ta-p/3518735
What I am trying to do for my application is to not allow a user to submit a blank or default value. I was wanting to make it where if a blank value was submitted for the string and listbox, a one button dialog appears and informs the user that they must be filled out to submit the information. I would need to check the listbox and the string, would I need to decluster that data to be able to check them or would it be possible to leave them clustered? Would this also require a new case structure?
I found one example on another forum but I wasn't sure if it was applicable for my situation, nor where I would put it in the code.
Any help would be greatly appreciated
Solved! Go to Solution.
04-07-2023 09:47 AM
Picture of code are not very helpful because we need be able to run your actual code to fix it.
But in general you need to error check every single input to make sure it is valid.
For instance if an input should be a persons name, you should check it to make sure it is not blank and does not contain numbers, punctuation, or special characters.
04-07-2023 10:14 AM
Here's the code I currently have! If I were to do an error check would I need to de-cluster the data or would it be possible to check using a case structure? Since I wanted a dialog to display if an area was left blank, would that need to be tied into the error check function as well?
04-07-2023 10:29 AM
04-07-2023 10:45 AM
Here are the files! I could've sworn I had attached them.
04-07-2023 11:09 AM
Many here don't have LabVIEW 2023 yet. You might get more responses if you would "save for previous" (e.g. to 2020 or below) before attaching.
04-07-2023 01:56 PM
Oh, I will next time. I managed to get something that works! I un-bundled the cluster and used a compare function "empty string/path" and compared it with my user form cluster, checked them through an and statement and re-bundled them. After that I converted the bundle to and array, then from an array to a number. THEN I just figured out the binary code and its respective number to create separate case statements for each possible occurrence.
There's probably a much easier way to do this but it works well for me. I attached an image of what I did for those curious.
Thanks everyone for the help!
04-10-2023 09:29 AM - edited 04-10-2023 09:40 AM
All you operation on the diagram constant cluster are always TRUE, so AND'ing with TRUE will just return the lower Boolean unchanged. Pure Rube Goldberg! You can delete all that without any change in functionality.
You can just use "build array" to turn the three booleans into an array. There is no need to go over a cluster of three booleans first.
It is probably a bad idea to make case=0 the default.
Assuming the case structure only has two cases (we cannot tell form the picture!), you could just do "OR array elements" to return false if no input error exists.
There are many places where your code is overly complicated. All you probably need is to change the comparison mode to compare elements and do a OR array elements to get true if any of the conditions is true.
04-10-2023 09:47 AM
I see what you're saying! So I should be able to remove the top cluster that compares the values with default values?
Its hard to tell from the picture so I'll attach the code, but I am using a cluster instead of an array since my data types are numerical and two strings. I have 8 case structures so far, each one just shows a different text box to tell you to fill out which ever field was left blank!
And since we don't have a carrier labeled as "0" I figured it would be okay since it means that the value hasn't been changed.
There is 100% an easier way to do this, it was just the first thing that came to mind.
04-10-2023 09:53 AM
Here's how it could look like: