キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

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 件の賞賛
メッセージ1/14
3,837件の閲覧回数

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 件の賞賛
メッセージ2/14
3,813件の閲覧回数

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 件の賞賛
メッセージ3/14
3,809件の閲覧回数

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 件の賞賛
メッセージ4/14
3,805件の閲覧回数

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 件の賞賛
メッセージ5/14
3,793件の閲覧回数

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 件の賞賛
メッセージ6/14
3,784件の閲覧回数

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 件の賞賛
メッセージ7/14
3,771件の閲覧回数

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 件の賞賛
メッセージ8/14
3,767件の閲覧回数

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

0 件の賞賛
メッセージ9/14
3,741件の閲覧回数

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 件の賞賛
メッセージ10/14
3,737件の閲覧回数