LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to not allow default values to be submitted

Solved!
Go to solution

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

Download All
0 Kudos
Message 1 of 15
(1,318 Views)

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. 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 15
(1,289 Views)

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?

0 Kudos
Message 3 of 15
(1,274 Views)

@paintman wrote:

Here's the code I currently have! 


Where?

0 Kudos
Message 4 of 15
(1,260 Views)

Here are the files! I could've sworn I had attached them. 

Download All
0 Kudos
Message 5 of 15
(1,240 Views)

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.

0 Kudos
Message 6 of 15
(1,231 Views)

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! 

0 Kudos
Message 7 of 15
(1,209 Views)

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.

0 Kudos
Message 8 of 15
(1,035 Views)

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. 

Download All
0 Kudos
Message 9 of 15
(1,022 Views)

Here's how it could look like:

 

  • Change equal comparison mode to "compare elements instead of aggregates"
  • Insert cluster to array
  • Insert Or array elements
  • Wire to case. Case FALSE happens is when none of the booleans are TRUE.

 

altenbach_0-1681138410850.png

 

Message 10 of 15
(1,020 Views)