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

Search in Array

manohar
Contributor

hi there, I have data coming in these structures
source1 -

{
            "@type": "array",
            "order-line": [
              {
                "line-num": "00010",
                "attachments": {
                  "@type": "array",
                  "attachment": {
                    "type": "AttachmentText",
                    "text": "Testing the Long Text Documents"
                  }
                }
              },
              {
                "line-num": "00020",
                "attachments": {
                  "@type": "array",
                  "attachment": [
                    {
                      "type": "AttachmentText",
                      "text": "This is the Third time being sent.\n\nIn our continuing efforts to reduce transportation costs and increaseefficiency Clearway Energy Inc. has contracted Malark Logistics andjointly developed the following routing instructions. Please complywith the following instructions. Failure to comply will result inescalating non-compliance fees beginning at $50.00 per shipment andreaching $250 plus freight costs for subsequent violations.\n"
                    },
                    {
                      "type": "AttachmentText",
                      "text": "This is the second time being sent.\n\nIn our continuing efforts to reduce transportation costs and increaseefficiency Clearway Energy Inc. has contracted Malark Logistics andjointly developed the following routing instructions. Please complywith the following instructions. Failure to comply will result inescalating non-compliance fees beginning at $50.00 per shipment andreaching $250 plus freight costs for subsequent violations.\n"
                    }
                  ]
                }
              }
            ]
          }

and source2 -

{
      "line-num": "00020",
      "attachments": [
        {
          "type": "AttachmentText",
          "text": "This is the second time being sent.\n\nIn our continuing efforts to reduce transportation costs and increaseefficiency Clearway Energy Inc. has contracted Malark Logistics andjointly developed the following routing instructions. Please complywith the following instructions. Failure to comply will result inescalating non-compliance fees beginning at $50.00 per shipment andreaching $250 plus freight costs for subsequent violations.\n",
          "Id": null
        }
      ]
    }

how can I compare to see Source2 Atttachment.Text exists in Attachment.Text of Source1โ€™s , where line-num is same?

Any help is greatly appreciated.

Thanks
Manohar

1 ACCEPTED SOLUTION

bojanvelevski
Valued Contributor

Hello @manohar,

You can also try this pipeline. As a result youโ€™ll get the original payloads, and an extra boolean field for the condition stated above.

Array Comparison_2021_06_29.slp (8.7 KB)

Regards,

Bojan

View solution in original post

8 REPLIES 8

HI @bojanvelevski, Thanks for that. I am still trying to tweak this to fit into my requirement. will let you know how that goes.

Thanks
Manohar

manohar
Contributor

Hi @bojanvelevski

We are letting go on looking for the Latest but instead we decided to add the date and time in the final text as below. if we were to search for rest of text (minus "datetime :- ") how would we do that?

Your help is greatly appreciated.

Thanks
Manohar

{
            "@type": "array",
            "order-line": [
              {
                "line-num": "00010",
                "attachments": {
                  "@type": "array",
                  "attachment": {
                    "type": "AttachmentText",
                    "datetime": "2021-07-04 18:20:10",
                    "text": "2021-07-04 18:20:10 :- Testing the Long Text Documents"
                  }
                }
              },
              {
                "line-num": "00020",
                "attachments": {
                  "@type": "array",
                  "attachment": [
                    {
                      "type": "AttachmentText",
                      "datetime": "2021-07-04 18:20:20",
                      "text": "2021-07-04 18:20:20 :- This is the Third time being sent.\n\nIn our continuing efforts to reduce transportation costs and increaseefficiency Clearway Energy Inc. has contracted Malark Logistics andjointly developed the following routing instructions. Please complywith the following instructions. Failure to comply will result inescalating non-compliance fees beginning at $50.00 per shipment andreaching $250 plus freight costs for subsequent violations.\n"
                    },
                    {
                      "type": "AttachmentText",
                      "datetime": "2021-07-04 19:40:21",
                      "text": "2021-07-04 19:40:21 :- This is the second time being sent.\n\nIn our continuing efforts to reduce transportation costs and increaseefficiency Clearway Energy Inc. has contracted Malark Logistics andjointly developed the following routing instructions. Please complywith the following instructions. Failure to comply will result inescalating non-compliance fees beginning at $50.00 per shipment andreaching $250 plus freight costs for subsequent violations.\n"
                    }
                  ]
                }
              }
            ]
          }

bojanvelevski
Valued Contributor

Hey @manohar ,

In this version, if the text is matched, the datetime will be added in the text result. Let me know if this works.

Array Comparison V1.2_2021_07_08.slp (9.3 KB)

Bojan

manohar
Contributor

Hey @bojanvelevski ,

Thank you for all your help.

Went bit different route using different snaps but used your logic in Compare_Community pipeline.

Thanks
Manohar