cancel
Showing results for 
Search instead for 
Did you mean: 

JSON Splitter for an Split column

pranil2k2
Contributor

Hi,
I have a requirement to read multiple XML files data and load into Oracle table. I am using Directory browser to read the list of XML files and passing the path to File reader and then XML Parser, from XML parser the output is given to mapper there i am splitting the data on a column using xx.split(‘\n’). The output from mapper is given to JSON Splitter to split on xxx, this is working good for one XML file, if i try to process for multiple XML files the JSON split is not working as excepted.

image

Even i tried by creating child pipeline and passing path value, but i am getting same results. it is splitting one XML properly and other XML with only one record.

Please some one can advice here.

As per my understanding, the Directory browser will execute one file at a time, please correct me if i am wrong.

1 ACCEPTED SOLUTION

pranil2k2
Contributor

Thanks for the help. i didnt do any changes but now the JSON splitter is working as excepted. i just delete every thing and re created.
Thanks again

View solution in original post

12 REPLIES 12

Hi Ptaylor,

As i mentioned above, i am applying split function on the xx column and that is generating an array. i am very sure the JSON is getting Array as input. i checked multiple times and as said above it is working if i execute the job for single file.

Thanks

pranil2k2
Contributor

I applied sl.ensureArray function and the column become an array, but still the problem exist as shown in above images

Note: The interesting part here is, i am passing file names to Directory browser which are saved in Excel file. if i remove excel file input and configure the Direcotry browser to read two files the problem is not coming the splitter is working as excepted. so is there any problem to pass file names from excel?

It’s not about whether there is one file or multiple files. The files will be parsed individually. It’s about what the data looks like in a single file. I’m guessing that things work fine when the data contains multiple elements at that path, since that will be parsed as an array, but fails when the data contains a single element at that path. You haven’t provided any detail about the failures – what errors are you seeing and what does the data look like for the failure cases?

pranil2k2
Contributor

Hi,

Ok, the data before JSON splitter… it has two rows
row1, row 2

The excepted output should be atleast more than one row in out put for two rows, but i am getting only one document as output for one of the xml

the excepted output is other columns also like version number,etc.
other xml is splitting as excepted.

As said earlier i didn’t find any issue if i execute pipeline for single files… i know as per logic it has to work because it is an array but i don’t know why it not splitting as excepted when i am trying to execute with multiple files…

koryknick
Employee
Employee

Are you able to share some sample input files and an export of your pipeline?

It might help us understand what you’re trying to do and the issue you are running into.