Forum Discussion

snowamigo's avatar
snowamigo
New Contributor
5 years ago
Solved

How to read the value from an array using expression builder and return true or false

My initial JSON looked like below

    "customFields": {
    "textCustomFields": [
      {
        "fieldId": "10546710413",
        "name": "templateUsageRestriction",
        "show": "false",
        "required": "false",
        "value": "allOptions"
      },
      {
        "fieldId": "10546710414",
        "name": "_source",
        "show": "true",
        "required": "false",
        "value": "ERM"
      },
      {
        "fieldId": "10546710415",
        "name": "_destination",
        "show": "true",
        "required": "false",
        "value": "xxx,yyy"
      },
      {
        "fieldId": "10546710416",
        "name": "_bu",
        "show": "true",
        "required": "false",
        "value": "ABC"
      },
      {
        "fieldId": "10546710417",
        "name": "_uid",
        "show": "true",
        "required": "false",
        "value": "pqr"
      },
      {
        "fieldId": "10546710418",
        "name": "_accountnumber",
        "show": "true",
        "required": "false",
        "value": "xyz"
      }
    ],
    "listCustomFields": []
  }

So I used below expression to map name => value.

Now I am trying to read the "_source’ element value, Ideally i want to do something like $.dsConfigAttributes[‘_source’] == ‘ERM’ return true else false to a target path
and
$.dsConfigAttributes[‘_source’] contains "ERM’ return to true else false to a target path

Any help is appreciated.

  • Hello @snowamigo,

    If you use this expression below, you will get true/false on the target path, respectively where the value of name is ‘_source’ and value of ‘value’ is ‘ERM’.

    .map(x=> x.name == ‘_source’ && x.value == ‘ERM’)

    If that is what you were aiming at. If not, please send more details on the output.

    Best regards,

    Bojan Velevski

1 Reply

  • hi @pvsharish9 ,

    Is the user emp added to the DB where you trying to connect to? with the right password?
    If Yes,

    Which JDBC Jars are you using have you tried this?
    JDBC Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver

    And maybe try also only with this Url properties:

    • selectMethod : cursor
      Or do you need those other properties?

    Advanced properties:

    Regards

    Jens