somik.mukherjee | 2021-12-16 06:54:12 UTC | #1
We are trying to pass the index position of the array to print only one set of values. However, we are getting the index position as an input contract. Issue is when we try to pass that inside an array, it is giving a JSON error:
Jason_Mathison | 2021-12-16 12:31:32 UTC | #2
Hi Somik,
In general, input variables are not available while handling the response. There is an idea for this: https://genesyscloud.ideas.aha.io/ideas/OTB-I-405
Please add your use case, making sure to note that you want to use it in the translation map.
If you can provide an example of the response you are getting from the endpoint (with anything sensitive covered up) maybe we can come up with a solution.
--Jason
somik.mukherjee | 2021-12-23 16:54:24 UTC | #3
Thank you @Jason_Mathison , I have raised the idea with use case. This would ideally be a long term solution.
Can you please suggest how can I link a servicer[0].appointments[*].group ID with a servicer[0].id incase I pass any groupId as input to this data action? I am passing all appointments across servicers and getting a specific group Id and appointment date/time in response. Now to trace this groupId back to the original servicer that contains it, can that be achieved?
Regards, Somik Mukherjee
Jason_Mathison | 2022-01-05 21:36:03 UTC | #4
If you control the API you could return the value that you want as part of the response. That would make it available during output processing. If that doesn't work, could you give a detailed example of what you are trying to accomplish?
--Jason
somik.mukherjee | 2022-01-06 16:15:55 UTC | #5
Hi Jason,
Below is the request body, based on the groupId associated with a specific date/time, we need to fetch servicer's Id, phone, etc.
{
"servicers": [
{
"name": "ABC SERVICER",
"id": "0076000",
"phoneNumber": "2699200000",
"ranking": "62.07",
"address": {
"street": "2404 W. Cross Hwy",
"aux": "",
"city": "Benton Harbor",
"state": "Michigan",
"zip": "49999"
},
"oemAuthorized": true,
"appointments": [
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-28T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-24T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-29T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-22T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-22T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-21T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-29T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-21T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-29T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-24T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-24T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-23T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-21T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-20T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-28T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-28T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-27T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-23T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-22T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-20T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-27T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-27T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-23T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-20T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-30T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-30T00:00:00",
"id": "64278294",
"groupId": "338837"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-30T00:00:00",
"id": "64278294",
"groupId": "338837"
}
],
"servicerType": 1,
"status": "Active"
},
{
"name": "ONSERVICE SERVICER SOLUTION",
"id": "0094700",
"phoneNumber": "8776600000",
"ranking": "0.0",
"address": {
"street": "9900 Corp Campus Dr",
"aux": "",
"city": "Louisville",
"state": "Kentucky",
"zip": "40000"
},
"oemAuthorized": false,
"appointments": [
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-17T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-18T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-27T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-28T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-29T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-17T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-20T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-22T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-24T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-24T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-29T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-22T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-26T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-26T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-30T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-17T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-21T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-23T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-23T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-18T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-18T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-21T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-22T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-27T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-28T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-30T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-19T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-23T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-30T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-19T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-20T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-21T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-26T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-28T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-29T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-19T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "12:00 PM",
"date": "2021-12-20T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "8:00 AM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-24T00:00:00",
"id": "64278294",
"groupId": "379055"
},
{
"appointmentStartTime": "12:00 PM",
"appointmentEndTime": "5:00 PM",
"date": "2021-12-27T00:00:00",
"id": "64278294",
"groupId": "379055"
}
],
"servicerType": 1,
"status": "Unapproved"
}
],
"success": true,
"resultMessages": null,
"responseIdentifier": "00000000-0000-0000-0000-000000000000"
}
Regards, Somik Mukherjee
Jason_Mathison | 2022-01-06 16:31:21 UTC | #6
Just to check, is the JSON you posted above the request to the service or the response from it?
In the original translationMap you posted you have a couple of things like [*.${input.rowIndex}] . What kinds of values would you expect rowIndex to be, and what would you expect the results of the JSONPath to be? I am accustomed to seeing a '*' or an assertion or a value inside of a array index [ ], not a combination of * and something else.
Finally, can you give an example of what the final output should look like?
--Jason
somik.mukherjee | 2022-01-07 04:14:10 UTC | #7
We are no longer passing rowindex as it is currently unsupported to pass integer value from Architect. The JSON I provided is the raw response. Considering servicer[] to have at max 3 array indexes, we have date field returned as "date": "2021-12-17T00:00:00" and "groupId": "379055". To locate if this combination belong to which servicer (2nd one in the above example) we expect below output to come out:
"name": "ONSERVICE SERVICER SOLUTION",
"id": "0094700",
"phoneNumber": "8776600000",
"ranking": "0.0",
"address": {
"street": "9900 Corp Campus Dr",
"aux": "",
"city": "Louisville",
"state": "Kentucky",
"zip": "40000"
},
"oemAuthorized": false, "servicerType": 1,
"status": "Unapproved"
Thanks, Somik Mukherjee
Jason_Mathison | 2022-01-07 14:36:32 UTC | #8
I am unaware of any issue sending an integer to a data action from architect, is that documented somewhere?
So I think that what you are trying to do is to find out which, if any, service providers have an appointment that matches the groupId and date.
I couldn't figure out a way to make a JSONPath expression that could do that. This JSONPath will return the appointments, but the specific service providers are missing: servicers[*].appointments[?(@.groupId=='379055' && @.date=='2021-12-17T00:00:00')]
I can get the service provider with an expression like this: servicers[?(@.appointments[0].groupId=='379055' && @.appointments[0].date=='2021-12-17T00:00:00')] however the array indexes had to be hard coded.
When I tried to use wildcards in the array indexes I got no results back servicers[?(@.appointments[*].groupId=='379055' && @.appointments[*].date=='2021-12-17T00:00:00')]
This looks like this issue to me: https://github.com/json-path/JsonPath/issues/466
You might comment on that issue to see if you can increase the priority of it.
For now, I think you might have to use a lambda data action or an intermediary service to process the appointment results.
system | 2022-02-07 14:36:44 UTC | #9
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 12972