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โ€ฆ