LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Return selected column header of table

Solved!
Go to solution

I'm sure there's probably a way of doing this.  But I haven't found it yet.

 

I'm building an application that will act as a kind of "universal" report generator for tables in a MySQL database. 

 

On startup, a Combo box is populated with table names of the database.  When the user selects one of those tables, the column names are retrieved from the database and used to populate the column headers of the LabVIEW table.  

 

The idea is that the user will be able to select that column and enter filter contraints into a text box.  Those constraints will then be added to the WHERE statement for that column.  

 

So far I've only been able to find a way to return the Active Cell or a Selection of Cells when the user clicks on the actual data in the table.  

 

Is there a direct way to retrun a  selected column header value in LabVIEW?

 

I'm musing there may be some kind of workaround using transparent controls on top of the headers.  But since different tables will have different numbers of columns that the user sets the width on, I'm not really sure this will work either.  

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 1 of 9
(4,693 Views)
you can make it a small subvi if you want to.
Message 2 of 9
(4,682 Views)

This is a nifty piece of code.  But not quite was a shooting for. 

 

This code works fine if a click the cell under the column header.  But not if click just the header itself.

 

Unless I hear otherwise, I think I'm going just have to force the user to deal with my workaround.   

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 3 of 9
(4,676 Views)

I'm in the process of shutting dwon for the week but I think there are methods you can use with the coordinates returned for a mouse down event that tell you where the click occured and if it was in a cell or not. please forgive if I mixed up my LV widgets.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 9
(4,673 Views)
Solution
Accepted by pallen
If you make the headers editable, this allows active cells to specify your column selected active row is -1 column is the selected column. you might have to use mouse down? to filter out the ability for the user to edit your column headers though.
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 5 of 9
(4,667 Views)

Ben wrote:

I'm in the process of shutting dwon for the week but I think there are methods you can use with the coordinates returned for a mouse down event that tell you where the click occured and if it was in a cell or not. please forgive if I mixed up my LV widgets.

 

Ben


One of my collegues here suggested something similar.  It could get a little tricky if the user resizes the columns, which is an option I think I need to leave open in this case.   But I'll look into it further.  

 

Thanks, and have a good weekend.    (Hopefully it'll quit raining up here long enough for me to get a hike in)

Message Edited by pallen on 07-24-2009 04:41 PM
---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 6 of 9
(4,662 Views)

falkpl wrote:
If you make the headers editable, this allows active cells to specify your column selected active row is -1 column is the selected column. you might have to use mouse down? to filter out the ability for the user to edit your column headers though.

Hmmm.....this has possibilities. 

 

I definately don't want the user changing the actual headers.  Although in this case, maybe I could call that a "feature".   Eventually the idea is that when the user has all the data filtered to his liking , he pushes an "export" buttton and everything is dumped to an Excel worksheet.  He can then manipulate it.  Create graphs.  Etc. Etc.   So maybe changing the headers to something other than somewhat non-intuitive field names in our database is desireable.  

 

Thanks for the suggestion. 

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 7 of 9
(4,661 Views)

Maybe it's just The Weekend talking.  But I'm thinking I may as well just put the header data into the top row of the table and call that the header. 

 

I think it would be easy enough to bold the text. Or make it a different colour.  Or even put a background colour in those cells.  

 

Seems like the top row would actually make a better header....than the header.  

 

 

...am I just being lazy if I go that route?

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 8 of 9
(4,645 Views)

pallen wrote:

Maybe it's just The Weekend talking.


 

Putting data in the top row was easy enough.  But not very useful if you want to scroll down more than a handful of rows.  

 

*insert forehead smack* 

 

I think the editable column headers are actually going to work out just perfectly for me.   Thanks Paul.  

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 9 of 9
(4,633 Views)