Child Tables

For some reason, I can’t get this to work. Hopefully someone will have an answer for me.

I am looking to put 2 tables in the same window.

The 1st is an Alarm Occurance table which basically just counts the number of times specific alarms have come up and displays the alarm name and then the count.

The second table is a details table that lists each instance of the alarm and it’s active / clear times when that alarm is selected in the 1st table.

My SQL astatement for the 1st table works fine and is as follows:

SELECT item_name, COUNT(item_name) as Occurances, group_name, state_name FROM alarmlog WHERE {Root Container.Filter.whereClause} GROUP BY item_name, group_name, state_name ORDER BY Occurances DESC {Root Container.Filter.limitFilter};

I’ve tried numerous ways to take care of the second table but nothing seems to work.

Any ideas on the correct SQL statement that will provide me with the details table?


You need to have two separate queries, one for each table. The first query will count the number of alarms grouped by item name. You can add a dynamic property to the table called selectedItemName that is bound to an expression: if({RootContainer.Table.selectedRow} != -1, {}[{RootContainer.Table.selectedRow}, "item_name"], "") So, when you select a row in the table the item name gets put in the dynamic property that you can use in the where clause of the second query (to get all of the alarms for that item name). Hope this helps.

that was all I needed to know and it all works great. I appreciate the time you took online with me.