multiple GEM identifier in standalone dashboard

Ask questions about the GEM here.
Post Reply
ecosang
Posts: 8
Joined: Thu Jun 15, 2017 8:51 am

multiple GEM identifier in standalone dashboard

Post by ecosang » Thu Jul 06, 2017 5:44 pm

Hello,
I am running two GEMs and collecting data using standalone dashboard.
For one GEM, I retrieved data by using "SELECT * FROM `minutedata` WHERE channel_id=x;" query in phpMyAdmin.

However, how can I separate each GEM's data from the same table?
I can find only one `minutedata` table in `dashboard` database. There is `devices` table, but no foreign key was found in `minutedata` from the `devices` table.

I think I can add foreign key on database, but I guess the data is already separated because when I looked at the line graph in each GEM, the two GEM's data are separated.

Thanks for the answers!
Attachments
erd.png
erd.png (259.95 KiB) Viewed 1535 times
ben
Site Admin
Posts: 4254
Joined: Fri Jun 04, 2010 9:39 am

Re: multiple GEM identifier in standalone dashboard

Post by ben » Fri Jul 07, 2017 9:54 am

ecosang wrote:Hello,
I am running two GEMs and collecting data using standalone dashboard.
For one GEM, I retrieved data by using "SELECT * FROM `minutedata` WHERE channel_id=x;" query in phpMyAdmin.

However, how can I separate each GEM's data from the same table?
I can find only one `minutedata` table in `dashboard` database. There is `devices` table, but no foreign key was found in `minutedata` from the `devices` table.

I think I can add foreign key on database, but I guess the data is already separated because when I looked at the line graph in each GEM, the two GEM's data are separated.

Thanks for the answers!

This will give you all channels that belong to one GEM (replace X's with Serial).

Code: Select all

SELECT * FROM channel 
INNER JOIN devices.device_id = channel.device_id 
WHERE serial = XXXXXXX;
Something similar to:

Code: Select all

SELECT * FROM minutedata 
INNER JOIN channel ON channel.channel_id = minutedata.channel_id 
INNER JOIN devices.device_id ON devices.device_id = channel.channel_id 
WHERE serial = XXXXXXX 
AND date BETWEEN 'START' AND 'END';
Should give you all minutedata between a date range for all channels on a GEM.
Ben
Brultech Research Inc.
E: ben(at)brultech.com
Post Reply