How can I achieve this design in LCA and what type will be GQI data?
Actually this group per service for view and aggregate count of alarms per service,
this should be dynamic when return from GQI script...I was able to get on table but how can I achiev the desired format in second image.
You can achieve this by changing the column appearance. It allows you to fully customize the look and feel of each cell, and the nice thing is that you can access all values from your row inside a single cell template. So in this use case I would
- Add a new column through GQI which is the concatenation of all state columns and name it 'Alarm state'.
- Hide all the individual severity columns by dragging the 'Name' and 'Alarm state' column from the query to the table.
- Customize the Alarm state column to show the individual severity columns in their corresponding colored shape.
If you are new to the template editor, I would recommend this nice tutorial on how to style a table.
Applied on your use case:
When needed, you could conditionally style it a bit more to get rid of any 0 counters:
The reason for Dynamic columns is one service can have 3 severity only so no need to show
But if tow services -> one has and one doesnt say for eg. timeout then for one it will show value and for other as 0.
So, how can I concatenate {0}/{1} and have column apperance thing done there.
Hi, I added a gif how I would do it
Hi thanks,
Its really helpful, but as I mentioned I have dynamic columns so it will problem to select on concatenation as per my previous comment as there can be 4 and for next 5…I think this only possible if I fix these are only gonna come, like Critical, Major, Minor then we can concatenate
Yes, it would indeed be safer to provide all possible severity columns up front. It's in general not a good idea to let a GQI return a dynamic amount of columns, because LCA rely heavily on those column IDs when you start creating interaction with the table, and a dynamic result could mess up these configurations.
Hi thanks,
but I am unable to find how can I concatenate my severity types will be DYNAMIC ALWAYS in one column and apply layout based on what filter
Just sending my code here where in for now I have both concatination of columns to alarm state as well as separate too, need to show the severity type and count in that
var columns = new List<GQIColumn>
{
new GQIStringColumn("Service Name"),
new GQIStringColumn("Alarm State"),
};
if (_severityTypes != null && _severityTypes.Any())
{
columns.AddRange(_severityTypes.Select(severity => new GQIStringColumn($"{severity}")));
}
return columns.ToArray();
public GQIPage GetNextPage(GetNextPageInputArgs args)
{
var rowsToReturn = new List<GQIRow>();
List<string> servicesName = new List<string>();
DmsAgent agent = new DmsAgent();
var services = GetServices().Select(x => x.Name).Distinct().ToList();
GetActiveAlarmsMessage getActiveAlarmsRequest = new GetActiveAlarmsMessage(agent.ID);
var res = _dms.SendMessage(getActiveAlarmsRequest) as ActiveAlarmsResponseMessage;
var activeAlarms = res.ActiveAlarms.WhereNotNull().ToList();
var filteredAlarms = activeAlarms
.Where(alarm => alarm.ViewImpactInfo.Any(x => x.Name == _view))
.ToList();
filteredAlarms.Select(alarm => alarm.Severity).Distinct();
var alarmServicePairs = new List<(string ServiceName, string Severity)>();
foreach (var alarm in filteredAlarms.OrderBy(x => x.Severity))
{
if (alarm.Services != null && alarm.Services.Length > 0)
{
servicesName.Clear();
foreach (var service in alarm.Services)
{
var request = new GetServiceByIDMessage(service);
if (_dms.SendMessage(request) is ServiceInfoEventMessage serviceInfo && services.Contains(serviceInfo.Name))
{
string serviceName = serviceInfo.Name;
servicesName.Add(serviceName);
}
}
foreach (var serviceName in servicesName)
{
alarmServicePairs.Add((serviceName, alarm.Severity));
}
}
}
var groupedByService = alarmServicePairs
.GroupBy(x => x.ServiceName)
.Select(serviceGroup => new
{
ServiceName = serviceGroup.Key,
Severities = serviceGroup.GroupBy(x => x.Severity),
});
foreach (var service in groupedByService)
{
var cells = new List<GQICell>
{
new GQICell { Value = service.ServiceName },
};
var severityCounts = service.Severities.ToDictionary(sg => sg.Key, sg => sg.Count());
var alarmState = string.Join(", ", severityCounts.Select(sc => $"{sc.Key}: {sc.Value}"));
cells.Add(new GQICell { Value = alarmState });
foreach (var severity in _severityTypes)
{
if (severityCounts.TryGetValue(severity, out var count))
{
cells.Add(new GQICell { Value = count.ToString() });
}
else
{
cells.Add(new GQICell { Value = "0" });
}
}
var key = $"{service.ServiceName}";
rowsToReturn.Add(new GQIRow(key, cells.ToArray()));
}
return new GQIPage(rowsToReturn.ToArray());