LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a table with strings active by boolean button

Solved!
Go to solution

Good morning.
I have a problem to create a table and did not find any topic in the forum who could help me solve this problem.
I need to create an alarm table.
That is, every time an alarm was activated (boolean button), the table will show the time,date and where that alarm occurred.
For example, when the garage alarm is activated, it will to table:

Date // Time //  Garage // Presence ON

And so on, when the alarm is activated the room:

Date // Time // Room // Presence ON

If anyone can help, I'd appreciate it enough.

Thank you.

0 Kudos
Message 1 of 8
(4,958 Views)

Hi Giuliano,

 

you need to collect those information in an array and then display that array in a table (or multicolumn listbox, or whatever).

 

Where are you stuck? What have you done so far?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(4,935 Views)

@Giuliano06 wrote:

Good morning.
I have a problem to create a table and did not find any topic in the forum who could help me solve this problem.
I need to create an alarm table.
That is, every time an alarm was activated (boolean button), the table will show the time,date and where that alarm occurred.
For example, when the garage alarm is activated, it will to table:

Date // Time //  Garage // Presence ON

And so on, when the alarm is activated the room:

Date // Time // Room // Presence ON

If anyone can help, I'd appreciate it enough.

Thank you.


your "table" is a 2D array of information. you can insert your 1D information(date/time/location/activation) using a "build array" when your buttons are activated using a state machine or event driven structure.
0 Kudos
Message 3 of 8
(4,933 Views)

Take a look at the Event Tracking.vi example in the example finder. This uses an event structure to determine when various controls change their value (which you will need to detect when your buttons are pressed) and writes data to a string indicator. You will want to write your data to a string array for display in a table, but otherwise this is most of your code written for you.

0 Kudos
Message 4 of 8
(4,921 Views)

So I can show the alarm, but when the button is not selected, it is sending null value (blank string) for the table through the shift register.

Also, when I select for example the 2 bedroom, he is moved to another column in the table and not just below the last alarm obtained.

My VI is attached case someone might have an idea.

0 Kudos
Message 5 of 8
(4,908 Views)

Take a look at what is happening in the code and follow the execution through...

 

You have a while loop that is looping continuously. The only thing governing when each the next iteration happens is how long the current iteration takes (which is determined by the 500ms timer)

 

Every time round the loop, you add a row to the string array.

 

Regardless of the state of the buttons you are adding a line every 500ms.

 

When a button is true the code in the true case executes and enters a line of data. Because you have mechanical action set to 'Latch' then as soon as the button value is read it reverts to false. The next iteration the button is false and the false case executes and adds 'default string values' (ie. empty strings) to the table because you have nothing in the false case.

 

Can I suggest again using events and looking at the example I mentioned earlier?

Message 6 of 8
(4,895 Views)
Solution
Accepted by Giuliano06

@Giuliano06 wrote:

So I can show the alarm, but when the button is not selected, it is sending null value (blank string) for the table through the shift register.

Also, when I select for example the 2 bedroom, he is moved to another column in the table and not just below the last alarm obtained.

My VI is attached case someone might have an idea.


your constantly polling the value to your table, ofcoarse this vi is designed according to the mechanical action of the boolean switch... Smiley Wink

Sensors table.png

Message 7 of 8
(4,887 Views)

This was exactly what I needed.
Thank you very much apok !!

 

 

Stuart.Parkins I saw the example you cited and could actually be a way of doing too!

Thank you too.

0 Kudos
Message 8 of 8
(4,859 Views)