Hi I have code:
public GQIPage GetNextPage(GetNextPageInputArgs args)
{
_logger.Information("Fetching next page");
var rows = new List<GQIRow>();
List<GetParameterResponseMessage> paramInfo = new List<GetParameterResponseMessage>();
try
{
foreach (var service in serviceList)
{
var childInfos = service.Children?.ToList();
if (childInfos.Count > 0)
{
var reqParam = new List<DMSMessage>();
foreach (var childInfo in childInfos)
{
var paramsNeeded = childInfo.Parameters
.Where(x => _resources.Any(y => y.ParamterId == x.ParameterID))
.ToList();
foreach (var parameter in paramsNeeded)
{
var msg = new GetParameterMessage(childInfo.DataMinerID, childInfo.ElementID,
parameter.ParameterID, parameter.FilterValue, true);
reqParam.Add(msg);
}
}
try
{
var responseMsg = _dms.SendMessages(reqParam.ToArray());
var response = responseMsg.OfType<GetParameterResponseMessage>().ToList();
paramInfo = response.FindAll(x => !string.IsNullOrEmpty(x.Value.ToString()) && !x.Value.ToString().Equals("EMPTY", StringComparison.CurrentCultureIgnoreCase)).ToList();
}
catch (Exception e)
{
_logger.Error($"Error fetching parameters: {e.Message}");
continue;
}
if (paramInfo.Any())
{
foreach (var childInfo in childInfos)
{
var cells = InitializeTableCells();
CreateElementRow(ref rows, childInfo, cells, paramInfo, service.Name);
}
}
}
}
return new GQIPage(rows.ToArray()) { HasNextPage = false };
}
catch (Exception e)
{
_logger.Error($"Error fetching elements: {e.Message}");
return new GQIPage(rows.ToArray()) { HasNextPage = false };
}
}
In this code how can I achieve pagination as the GetNextPage is called every time as I have trigger attached to table, so how can pagination work to get data fast without hanging the LCA