cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Evaluating an array value that's nested in a Group By Field and Routing the Group By Level based on Array value

bcole
New Contributor

I have created a Group By Field on an Order Number. Underneath that order number I have an array of AI_Status values. I would like to assess the entire array if any of the AI_Status values with the array are outside of the following array values [8, 16,32] and if so I would like to route that order number and the underneath array down one path and send the Order Number who AI_Statuses are either an 8,16, or 32 down another path.
Below is an example of the JSON as it exits the Group By Field Snap:
[
{
โ€œgroupByโ€: {
โ€œContextNameโ€: โ€œ202206871SRCNโ€
},
โ€œprocessesโ€: [
{
โ€œNameโ€: โ€œAU-I6โ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.487โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.000โ€
},
โ€œAI_Statusโ€: 70,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206871SRCNโ€
},
{
โ€œNameโ€: โ€œAU-I50โ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.530โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.000โ€
},
โ€œAI_Statusโ€: 8,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206871SRCNโ€
},
{
โ€œNameโ€: โ€œAU-CORP1Buyโ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.540โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.000โ€
},
โ€œAI_Statusโ€: 8,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206871SRCNโ€
},
{
โ€œNameโ€: โ€œAU-UCCFinPโ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.557โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.000โ€
},
โ€œAI_Statusโ€: 8,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206871SRCNโ€
},
{
โ€œNameโ€: โ€œAU-S11โ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.570โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.000โ€
},
โ€œAI_Statusโ€: 8,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206871SRCNโ€
},
{
โ€œNameโ€: โ€œAU-T1a AUโ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.590โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.000โ€
},
โ€œAI_Statusโ€: 8,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206871SRCNโ€
},
{
โ€œNameโ€: โ€œAU-CORP1Selโ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.610โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.000โ€
},
โ€œAI_Statusโ€: 8,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206871SRCNโ€
},
{
โ€œNameโ€: โ€œAU-X13โ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.627โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:28:05.000โ€
},
โ€œAI_Statusโ€: 8,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206871SRCNโ€
}
]
},
{
โ€œgroupByโ€: {
โ€œContextNameโ€: โ€œ202206896SRCNโ€
},
โ€œprocessesโ€: [
{
โ€œNameโ€: โ€œAU-I6โ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.487โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.000โ€
},
โ€œAI_Statusโ€: 8,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206896SRCNโ€
},
{
โ€œNameโ€: โ€œAU-I50โ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.530โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.000โ€
},
โ€œAI_Statusโ€: 8,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206896SRCNโ€
},
{
โ€œNameโ€: โ€œAU-CORP1Buyโ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.540โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.000โ€
},
โ€œAI_Statusโ€: 8,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206896SRCNโ€
},
{
โ€œNameโ€: โ€œAU-UCCFinPโ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.557โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.000โ€
},
โ€œAI_Statusโ€: 8,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206896SRCNโ€
},
{
โ€œNameโ€: โ€œAU-S11โ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.570โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.000โ€
},
โ€œAI_Statusโ€: 8,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206896SRCNโ€
},
{
โ€œNameโ€: โ€œAU-T1a AUโ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.590โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.000โ€
},
โ€œAI_Statusโ€: 8,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206896SRCNโ€
},
{
โ€œNameโ€: โ€œAU-CORP1Selโ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.610โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.000โ€
},
โ€œAI_Statusโ€: 8,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206896SRCNโ€
},
{
โ€œNameโ€: โ€œAU-X13โ€,
โ€œEnabledโ€: true,
โ€œAI_CreatedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.627โ€
},
โ€œAI_QueuedOnโ€: {
โ€œ_snaptype_localdatetimeโ€: โ€œ2022-11-07T22:27:05.000โ€
},
โ€œAI_Statusโ€: 8,
โ€œAi_Reasonโ€: โ€œCompleted successfully.โ€,
โ€œContextNameโ€: โ€œ202206896SRCNโ€
}
]
}
]

4 REPLIES 4

bojanvelevski
Valued Contributor

Hello @bcole,

I included a pipeline in the post that evaluates the array by using the array filter function. If the array objects, are filtered out based on the AI_Status field (their value is 8,16 or 32), and the array is not empty, then that means one of the AI_Statuses has some other value.

I named that additional field as routingPath which can be easily used for further processing, in your case routing.

Routing_FieldValue_2022_11_10.slp (11.7 KB)

Hope this helps,
Bojan

Bojan,

I think that solutions works nicely. Thank you so much. I just have one other question. What is the best way to add a value, specifically the IpaasQueueId , and EntityKey to Rows that are further down stream like after the stored procedure snap. The first SQL Snap and the second snap have an EntityKey = ContextName relationship. I need that and the IpaasQueueId from the first SQL call.

~WRD0000.jpg

bojanvelevski
Valued Contributor

Iโ€™m not sure I understand @bcole, can you elaborate a bit more?

Hi Bojan,

I think I figured it out. Perhaps the diagram below can show you what I was asking. I wanted to pull data from one early snap and get that information back way further down the pipeline.

I needed to join some of my original data from the first SQL Server JSON response with Data from my SQL Store Procedure call: I was asking for the preferred way of making that happen. Below is what I came up with. Unless you have a better idea, I think we can consider the case closed.

The expression you sent was great, but how would I know to use the โ€œmatchโ€ with the filtering. I have taken your Expression training class, but I would like to know another resource that can help me learn to create all the complicated Expressions I will need going forward. Also I tried using jsonPath to reach a solution. Some of the jsonPath would work on online validators, but would not inside various snaps.

Where do you point people to learn the brand of jsonPath that works here?

image001.png

~WRD0000.jpg