avpath - Location path - Cloud

Talend Cloud Pipeline Designer User Guide

EnrichVersion
Cloud
EnrichProdName
Talend Cloud
EnrichPlatform
Talend Pipeline Designer
task
Administration and Monitoring > Monitoring executions
Administration and Monitoring > Monitoring logs
Data Governance > Filtering data
Data Quality and Preparation > Filtering data
Data Quality and Preparation > Managing datasets
Deployment > Deploying > Executing Pipelines
Design and Development > Designing Pipelines
To select items in avpath, you use a location path. A location path consists of one or more location steps.
  • Location steps start with a dot or two dots:

    Syntax

    Location

    .property

    locates property immediately descended from context items

    ..property

    locates property deeply descended from context items

    .

    locates context items themselves

  • You can use the wildcard symbol instead of the exact name of the property:

    Syntax

    Location

    .*

    locates all properties immediately descended from the context items

    ..*

    locates all properties deeply descended from the context items

  • avpath allows you to join several properties:

    Syntax

    Location

    (.property1 | .property2 | .propertyN)

    locates property1, property2, propertyN immediately descended from context items

    (.property1 | .property2.property2_1.property2_1_1)

    locates .property1, .property2.property2_1.property2_1_1 items

Your location path can be absolute or relative. If location path starts with the root (^) you are using an absolute location path — your location path begins from the root items.

Example of Avro data (an Avro record containing a list of subrecords - clients):

var doc =
"""
  {
    "customers" : [
      {
        "id": "1",
        "Firstname": "Quentin",
        "Lastname": "Novo",
        "Address": { "Street" : "South Roosevelt Drive" },
        "RegistrationDate": "20/01/2015",
        "Revenue": "55239",
        "States": "AZ"
      },
      {
        "id": "2",
        "Firstname": "Kip",
        "Lastname": "Von Celaeno",
        "Address": { "Street" : "Carpinteria Avenue" },
        "RegistrationDate": "19/05/2016",
        "Revenue": "78148",
        "States": "NC"
      },
      {
        "id": "3",
        "Firstname": "Beau",
        "Lastname": "Dash",
        "Address": { "Street" : "Corona Del Mar" },
        "RegistrationDate": "28/09/2009",
        "Revenue": "77912",
        "States": "CT"
      }
    ]
  };
"""

Example of location path:

// find all customers addresses
avpath.select(doc, ".customers.Address")
// [{ Street : 'South Roosevelt Drive' }, { Street : 'Carpinteria Avenue' }, { Street : 'Corona Del Mar' }]

// find all customers address streets
avpath.select(doc, ".customers.Address.Street")
// ['South Roosevelt Drive', 'Carpinteria Avenue', 'Corona Del Mar' ]

// find all streets in customers*
avpath.select(doc, ".customers..Street")
// ['South Roosevelt Drive', 'Carpinteria Avenue', 'Corona Del Mar' ]