LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Apply filters to multi column list box

Hi,

 

I have an application where I am reading Excel sheet and displaying the data in MC column list box.

I need to have a provision where user can apply filters on Column Header. The filter view shall populate all the data in that respective column and with checkmarks placed I can select only necessary data to view

Is it possible?

If yes, a sample VI would be really helpful.

 

0 Kudos
Message 1 of 8
(2,508 Views)

@SuLAB wrote:

Is it possible?

If yes, a sample VI would be really helpful.


Sure, that's possible.

 

Problem is there are tons of ways to do it. Each way will be quite some work (like, hours-days).

 

How do you get the data from Excel?

 

How do you want to filter? Text? Regular expression? Value? Value range? Each column it's own filter? Etc.

 

What in particular is the problem to make this? The GUI? Handling the data? Handling the events? The filtering?

 

I'd probably use a SQL query to get the Excel data. Then the filters could (maybe) be translated to the query, and a new query with changed filters would simply return the filtered results.

0 Kudos
Message 2 of 8
(2,491 Views)

Hi,

 

Please find answers to your questions as below - 

1. I get the data from  Excel in 2d array of string  which I pass to MC Listbox.

2. The application need is same as that of Excel filter.

When applied it should populate all the data in the respective column with checkmarks against it the search option, ok and cancel button.  PFA screenshot for reference as in Excel.

SuLAB_0-1608736177280.png

3. I would say, I need all of these together in this application. So that I can view the data, filter it, ,make necessary changes in the selected data, and save back to excel

 

I really don't know SQL and need simple ways to achieve it if there are any.

 

0 Kudos
Message 3 of 8
(2,471 Views)

@SuLAB wrote:

I really don't know SQL and need simple ways to achieve it if there are any.


There isn't.

 

This will require work. This isn't absolute beginner stuff. Of course you can raise the bar and learn... 

 

I don't have a clear recollection of how the filters work in Excel..

 

I'd start with abstractions. This is not something that is going to work well (maintainable, extendable) in a one liner. This requires logic that simply won't fit in one big main VI.

 

You'd need a good 'divide and concur' tactic. For me, that would mean doing a OO breakdown. But any separation into libraries, groups, functionality would be better than the one liner.

 

 

0 Kudos
Message 4 of 8
(2,439 Views)

Hi,

sorry to post here, this was the closest to my problem, I thought maybe you could help. 

I am using an SQL quary to read data into a MCLB, I have many rows, and want to build a search box for user to input the name they are looking for, hit search button, and hopefully the row containing this entry will be marked. The entries are strings. Can you recommend where to start or how to implement this? 

Seli6272_0-1718198311134.png

 

Seli6272@D
0 Kudos
Message 5 of 8
(678 Views)

Hi Seli,

 


@LZD_Sydney wrote:

I am using an SQL quary to read data into a MCLB, I have many rows, and want to build a search box for user to input the name they are looking for, hit search button, and hopefully the row containing this entry will be marked. The entries are strings. Can you recommend where to start or how to implement this? 


So you have a 2D array of strings to be displayed in your MCLB:

  • Search for the user-input string inside your 2D array of strings: you will receive the index of the found string element.
  • Use that index to highlight/mark the corresponding row in your MCLB. You can either use the cell properties (background color or other) or the additional symbol (in the first column of the MCLB) to do so… (You could also scroll the MCLB content to the found row if it's "out of view" using property nodes.)

What have you tried and where are you stuck?

Best regards,
GerdW


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

Thanks for the quick reply. This is my code sofar. 

 

Seli6272_0-1718200703368.png

 

I don't know how to get the index as a single number, basically the row number, and how to scroll down to/highlight  it, as you mentioned above. 

Seli6272@D
0 Kudos
Message 7 of 8
(667 Views)

Hi Seli,

 


@LZD_Sydney wrote:

I don't know how to get the index as a single number, basically the row number, and how to scroll down to/highlight  it, as you mentioned above. 


  • Your search routine results in a 2D array of 2 columns, with row in the first column.
  • When you only need the "first found" index then you should use the upper left element of your 2D search result (at index [0, 0])…
  • To change the properties of the MCLB you need to use property nodes of the MCLB! There are properties like BackgroundColor and ActiveCell…
Best regards,
GerdW


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