Good morning,
I have a BAQ with a BPM that calls a function to pull a list of employee IDs from my timeclock API. The string EmpIDs is populated with a comma delimited list of ID numbers without spaces, or any other characters. This is the custom code block that generates the error:
InfoMessage.Publish(EmpIDs.ToString());
string[] emp = EmpIDs.Split(',');
var i = 0;
while (i < emp.Length)
{
InfoMessage.Publish(emp[i]);
i++;
}
In this case. If I change [i] to a number that falls in my employee count range, then I do get the info message for that employee id. However, if I run it as shown with [i] in place, then I get this error:
Unterminated string. Expected delimiter: ". Path ‘Context.InfoMessage[54].SysRowID’, line 1, position 18724.
Application Error
Exception caught in: Newtonsoft.Json
Error Detail
============
Message: Unterminated string. Expected delimiter: ". Path 'Context.InfoMessage[54].SysRowID', line 1, position 18724.
Program: Newtonsoft.Json.dll
Method: ReadStringIntoBuffer
Client Stack Trace
==================
at Newtonsoft.Json.JsonTextReader.ReadStringIntoBuffer(Char quote)
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.JsonTextReader.Read()
at Ice.Api.Serialization.JsonReaderExtensions.ReadAndAssert(JsonReader reader)
at Ice.Api.Serialization.IceTableConverter.CreateRow(JsonReader reader, IIceTable table, Lazy`1 lazyUDColumns, JsonSerializer serializer)
at Ice.Api.Serialization.IceTableConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Ice.Api.Serialization.IceTablesetConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Ice.Cloud.ProxyBase`1.ProcessJsonReturnHeader[TOut](KeyValuePair`2 messageHeader)
at Ice.Cloud.ProxyBase`1.SetResponseHeaders(HttpResponseHeaders httpResponseHeaders)
at Ice.Cloud.ProxyBase`1.HandleContractAfterCall(HttpResponseHeaders httpResponseHeaders)
at Ice.Cloud.ProxyBase`1.CallWithMultistepBpmHandling(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, Boolean useSparseCopy)
at Ice.Cloud.ProxyBase`1.Call(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, Boolean useSparseCopy)
at Ice.Proxy.BO.DynamicQueryImpl.GetList(DynamicQueryDataSet queryDS, QueryExecutionDataSet executionParams, Int32 pageSize, Int32 absolutePage, Boolean& hasMorePage)
at Ice.Adapters.DynamicQueryAdapter.<>c__DisplayClass45_0.<GetList>b__0(DataSet datasetToSend)
at Ice.Adapters.DynamicQueryAdapter.ProcessUbaqMethod(String methodName, DataSet updatedDS, Func`2 methodExecutor, Boolean refreshQueryResultsDataset)
at Ice.Adapters.DynamicQueryAdapter.GetList(DynamicQueryDataSet queryDS, QueryExecutionDataSet execParams, Int32 pageSize, Int32 absolutePage, Boolean& hasMorePage)
at Ice.UI.App.BAQDesignerEntry.BAQTransaction.TestCallListBckg()
at Ice.UI.App.BAQDesignerEntry.BAQTransaction.<>c__DisplayClass220_0.<BeginExecute>b__0()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
The error seems to point to JSON parsing, but the string EmpIDs is returned correctly. I can prove this by changing [i] to a number. The first info message showing the entire comma delimited list is shown, and the single empid is show in the inside info message.
I have also tried a for loop with the same results. It seems I can see the EmpIDs, and I can split it, but I can’t call the result of the split properly. What did I miss?
Thanks for your time!