LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading access database : Grouped data

Hi ,

 

I am reading access database thru Database connectivity toolkit , My database has grouped data on every single row , but when I am reading data it , it is only giving me the parent of the group . Please see the attached for what I am trying to do.

 

if it possible to read the contents under it when we expand it , please let me know how to do it

 

Thanks for your help

Manreet

 

 

0 Kudos
Message 1 of 14
(3,223 Views)

Your query has a where statement of ID = 1.  This doesn't match with the data that you want to see, since those records have an ID > 199.  Obviously there is something within Access that is displaying this secondary data like this.  The only way you'll be able to see that data is by writing a query that pulls it out, which is what Access is doing behind the scenes. 

aputman
0 Kudos
Message 2 of 14
(3,199 Views)

Hi , 

 

Thank you for your reply !

 

just for clarification , so under the ID=1 row , it has another table with a field called "ID" as well and group begins with 199 , so there is a table with a column called "ID" and inside each row of that table there is grouped data which also has a column called "ID" and these 2 ID columns have 2 different sets of data. 

 

I am not sure how can I query something that labview can not even see. it does not know there is grouped data under each row.

0 Kudos
Message 3 of 14
(3,195 Views)

How are the tables linked?  How does ID 1 in the first table know to display ID > 199 in the second table?  There has to be a key that links them.

 

SELECT * 
FROM table2
WHERE key = (SELECT key FROM table1 where ID = 1)

Edit: Maybe your ID is the key but I don't see any relationship in the data that you have posted.   

aputman
0 Kudos
Message 4 of 14
(3,191 Views)

Attached is the database , you will see 2 tables , one called step result and another called trans result.

 

The way the 2 tables are linked is ID field of the trans result is equal to the Trans result field of the step result table

 

I looked up the query behind the table and it is 

SELECT*
FROM TRANS_RESULT INNER JOIN STEP_RESULT ON TRANS_RESULT.ID =STEP_RESULT.TRANS_RESULT

 

I am not sure how to open connection to this database and select both the tables at the same time so I can execute this query to join them

0 Kudos
Message 5 of 14
(3,179 Views)

Getting data from a linked table is not the same as getting the linked data.  If you want to get the grouped data, you have to create the query, either as a query table in the database, or using the 'DB Tools Execure Query' VI

0 Kudos
Message 6 of 14
(3,170 Views)

You'll definitely need to use the Execute Query VI and then convert the dataset to an array of strings.

 

Example_VI_BD.png

aputman
0 Kudos
Message 7 of 14
(3,157 Views)

Thank you so much for being so clear , I will try this out and let you know if it was a success,

 

Much appreciated !

0 Kudos
Message 8 of 14
(3,153 Views)

so I tried it , this is what happened refer attached , any thoughts ?

0 Kudos
Message 9 of 14
(3,127 Views)

That's how a join works.  It's trying to combine every single row in one table with every single row in the the other table where the two ID's are equal.  When you run this in Access, it is able to display it in a grouped view so that the duplicate data is filtered, rather than showing all of the data as you are seeing in LabVIEW.  

aputman
0 Kudos
Message 10 of 14
(3,123 Views)