cancel
Showing results for 
Search instead for 
Did you mean: 

How to access a field in Child Pipe Line

sjakathi
New Contributor II

Hi,
when I am trying to access Col Desc field in child pipe line getting the below error
sample JSON
{
“Style”:“Pen”,
“Col Desc”: “Black”
}

image

“failure”: “Validation errors:\nproperty_map.settings.transformations.value.mappingTable.value[4].expression.value: Expression parsing failed near – _content). >> [ << 'Çol Desc (Reason: Mismatched input ‘[’ at line 1:21. Expecting one of: {, ‘||’, ‘&&’, ‘^’, ‘==’, ‘!=’, ‘>’, ‘<’, ‘>=’, ‘<=’, ‘+’, ‘-’, ‘*’, ‘/’, ‘%’, ‘?’, ‘instanceof’, ‘in’, ‘matches’}; Resolution: Please check expression syntax)\n”,

1 ACCEPTED SOLUTION

Hi, attaching the pipelines for your reference that work both with eval and JSON.parsetest child properties_2021_02_01.slp (5.1 KB) mapper_2021_02_01.slp (3.8 KB)
let me know if you have any questions.

View solution in original post

4 REPLIES 4

cstewart
Former Employee

If you are trying to get the value of something passed to the pipeline in a pipeline parameter, you will have to parse the JSON fiorst, then you can access the field, use an expression like:
JSON.parse(_content)[‘Col Desc’]

sjakathi
New Contributor II

Thanks For the reply …
when I am using the JSON.parse(_content)[‘Col Desc’] getting the below error.When I use the suggestion which snaplogic provided(Error Resolution) then the values are coming as null. image

Hi, attaching the pipelines for your reference that work both with eval and JSON.parsetest child properties_2021_02_01.slp (5.1 KB) mapper_2021_02_01.slp (3.8 KB)
let me know if you have any questions.

sjakathi
New Contributor II

Thanks it worked…