This commit is contained in:
2021-06-24 22:47:09 +00:00
parent b7c69cb8cf
commit 600fc09b39
4 changed files with 21 additions and 5 deletions

View File

@@ -182,7 +182,7 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get data from id list in format used by report designer
/// Get a limited amount of sample data from id list in format used by report designer
/// </summary>
/// <param name="selectedRequest">Data required for report</param>
/// <param name="apiVersion">From route path</param>
@@ -196,6 +196,8 @@ namespace AyaNova.Api.Controllers
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
//cap the data returned
selectedRequest.ReportDesignerSample = true;
var reportData = await biz.GetReportData(selectedRequest);
if (reportData == null)

View File

@@ -189,9 +189,17 @@ namespace AyaNova.DataList
/////////////////////////////////////////////////////////////////
// Get a list of id's of the datalist results for reporting
// (and other uses like job ops, exporting etc)
// called from RehydrateIdList only
//
//
internal static async Task<long[]> GetIdListResponseAsync(AyContext ct, DataListSelectedProcessingOptions dataListSelectionOptions, IDataListProcessing DataList, AuthorizationRoles userRoles, ILogger log, long userId)
internal static async Task<long[]> GetIdListResponseAsync(
AyContext ct,
DataListSelectedProcessingOptions dataListSelectionOptions,
IDataListProcessing DataList,
AuthorizationRoles userRoles,
ILogger log,
long userId,
bool limitForReportDesigner)
{
//#BUILD THE QUERY
@@ -210,10 +218,15 @@ namespace AyaNova.DataList
//ORDER BY CLAUSE - SORT
qOrderBy = DataListSqlFilterOrderByBuilder.DataFilterToSQLOrderBy(DataList.FieldDefinitions, dataListSelectionOptions);
//LIMIT (if report designer)
var qLimit = string.Empty;
if (limitForReportDesigner)
qLimit = "LIMIT 5";
//PUT IT ALL TOGETHER
string qDataQuery = string.Empty;
qDataQuery = $"{qSelect} {qFrom} {qWhere} {qOrderBy} ".Replace(" ", " ");
qDataQuery = $"{qSelect} {qFrom} {qWhere} {qOrderBy} {qLimit} ".Replace(" ", " ");
//RETURN OBJECTS
var retList = new List<long>();

View File

@@ -65,7 +65,7 @@ namespace AyaNova.Models
DataListSelectedProcessingOptions d = new DataListSelectedProcessingOptions(selectedRequest, DataList, SavedView, SavedFilter, userId, userRoles);
return await AyaNova.DataList.DataListFetcher.GetIdListResponseAsync(ct, d, DataList, userRoles, log, userId);
return await AyaNova.DataList.DataListFetcher.GetIdListResponseAsync(ct, d, DataList, userRoles, log, userId, selectedRequest.ReportDesignerSample);
}

View File

@@ -8,6 +8,7 @@ namespace AyaNova.Models
public AyaType AType { get; set; }
public long[] SelectedRowIds { get; set; }
public bool IncludeWoItemDescendants {get;set;}
public bool ReportDesignerSample {get;set;}//set if for report designer to limit rows returned to a sensible limit
}
}