LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert 1D array output to boolean

Hi, I need help. Im trying to make a login page, and I am using an array to stock the user emails and passwords, and using this inside of a for loop, so, I need to compare that array with the user insertions, but I have a problem because, the software show me this error:

"You have connected two terminals of different types, the type of the source is 1D array of boolean(TRUE or FALSE), the type of the sink is boolean(TRUE or FALSE)". Here is a image: Captura de Pantalla 2021-08-12 a la(s) 11.22.09 a. m..png

 

What can I do?

0 Kudos
Message 1 of 4
(1,904 Views)

Hi Jhonatan,

 

you are testing two items of "Correos" for being equal to "Usuario": what should happen when

  1. none
  2. the first
  3. the second
  4. both items

are same?

 

Once you answer this question you can decide to use an AND or OR function to reduce the array of booleans to a scalar boolean…

 

Btw. you might learn about autoindexing at loop borders to simplify your VI!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(1,893 Views)

I assume that the array has two elements and cannot change during the loop execution. Similarly, the scalar cotrnol os also loop invariant. Thus both controls belong before the loop.

 

The entire loop can be replaced by a "search array" function. You get -1, 0, or 1 as possible output, depending if none, he first or the second element is equal.

 

NOTE: you'll get much better help if you would attach your actual VI. Many things cannot be determined from a picture (e.g. the size of the string array, the default values for the controls, etc.)

Message 3 of 4
(1,878 Views)

@altenbach wrote:

The entire loop can be replaced by a "search array" function.


 

Here's how that could look like. See if you can recreate it:

 

altenbach_0-1628790229631.png

 

Message 4 of 4
(1,872 Views)