Page 1 of 1

multiple GEM identifier in standalone dashboard

Posted: Thu Jul 06, 2017 5:44 pm
by ecosang
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!

Re: multiple GEM identifier in standalone dashboard

Posted: Fri Jul 07, 2017 9:54 am
by ben
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.