diff --git a/docs/8.0/ayanova/docs/ay-start-form-picklist.md b/docs/8.0/ayanova/docs/ay-start-form-picklist.md index fe1328d5..d280be12 100644 --- a/docs/8.0/ayanova/docs/ay-start-form-picklist.md +++ b/docs/8.0/ayanova/docs/ay-start-form-picklist.md @@ -3,6 +3,7 @@ ## Pick list overview some are search only, some pick and search etc +initial form load preselected will not fill list if it doesn't have to to save bandwidth ## Selecting diff --git a/server/AyaNova/Controllers/PickListController.cs b/server/AyaNova/Controllers/PickListController.cs index 269bef5b..6f7bcdb8 100644 --- a/server/AyaNova/Controllers/PickListController.cs +++ b/server/AyaNova/Controllers/PickListController.cs @@ -55,9 +55,10 @@ namespace AyaNova.Api.Controllers /// Independantely of this, if an addition space separated string that begins with two consecutive periods is encountered that will be considered a separate match to the TAGS collection of each object /// So a tag query might be entered as "..zon some" which would match all tags LIKE 'zon' and template fields LIKE 'some' /// Include inactive objects in the returned list + /// Return only one item (for pre-selected items on forms) /// Filtered list [HttpGet("List")] - public async Task GetList([FromQuery]AyaType ayaType, [FromQuery]string query, [FromQuery] bool inactive) + public async Task GetList([FromQuery]AyaType ayaType, [FromQuery]string query, [FromQuery] bool inactive, [FromQuery]long preId) { if (!serverState.IsOpen) return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); @@ -80,7 +81,7 @@ namespace AyaNova.Api.Controllers //Instantiate the business object handler PickListBiz biz = PickListBiz.GetBiz(ct, HttpContext); - var o = await biz.GetPickListAsync(PickList, query, inactive, log); + var o = await biz.GetPickListAsync(PickList, query, inactive, preId, log); if (o == null) return BadRequest(new ApiErrorResponse(biz.Errors)); else diff --git a/server/AyaNova/PickList/PickListFetcher.cs b/server/AyaNova/PickList/PickListFetcher.cs index 51ccf5e5..e7dd1979 100644 --- a/server/AyaNova/PickList/PickListFetcher.cs +++ b/server/AyaNova/PickList/PickListFetcher.cs @@ -11,7 +11,7 @@ namespace AyaNova.PickList internal static class PickListFetcher { internal static async Task> GetResponseAsync(IAyaPickList PickList, string autoCompleteQuery, - string tagSpecificQuery, bool includeInactive, AyContext ct, ILogger log) + string tagSpecificQuery, bool includeInactive, long preId, AyContext ct, ILogger log) { //Sort out effective Template @@ -68,7 +68,7 @@ namespace AyaNova.PickList //log out the exception and the query log.LogInformation("PickList query failed unexpectedly. Query was:"); log.LogInformation(q); - log.LogInformation(e,"DB Exception"); + log.LogInformation(e, "DB Exception"); throw new System.Exception("PickListFetcher - Query failed see log"); } diff --git a/server/AyaNova/biz/PickListBiz.cs b/server/AyaNova/biz/PickListBiz.cs index c1b39732..f1e2786b 100644 --- a/server/AyaNova/biz/PickListBiz.cs +++ b/server/AyaNova/biz/PickListBiz.cs @@ -70,7 +70,7 @@ namespace AyaNova.Biz //get picklist - internal async Task> GetPickListAsync(IAyaPickList PickList, string query, bool inactive, ILogger log) + internal async Task> GetPickListAsync(IAyaPickList PickList, string query, bool inactive, long preId, ILogger log) { //Crack and validate the query part set a broken rule if not valid and return null @@ -134,7 +134,7 @@ namespace AyaNova.Biz } //Autocomplete and tagonly query terms now set for consumption by PickListFetcher, ready to fetch... - List items = await PickListFetcher.GetResponseAsync(PickList, AutoCompleteQuery, TagSpecificQuery, inactive, ct, log); + List items = await PickListFetcher.GetResponseAsync(PickList, AutoCompleteQuery, TagSpecificQuery, inactive, preId, ct, log); return items; }