01-17-2022 06:26 AM
We want the ability to write a document to a new row within a CSV file. This is only if the document meets certain requirements
Is this possible?
This article from a few years back suggests not and wondered if there has been any advancements
Solved! Go to Solution.
01-20-2022 09:45 AM
Hello, here’s an update.
I found this article and used the expression to update the one on my Mapper snap. The resulting dat structure in the target path is the desired outcome!
This is great stuff so far. I’ll probably take a break now from testing and have some dinner before recommencing tomorrow. Thank you @j.angelevski for your patience.
01-17-2022 06:36 AM
Hi @NAl,
You can write a new row in the file ( I suppose you want “append” ) but that’s supported only for FTP, FTPS and SFTP file protocols.
If you want to replicate this sort of logic, you can follow these steps:
$old_data.concat($new_data)
In this case, your new data will be always appended.
The pipeline should look something like this:
01-19-2022 07:34 AM
Thank you for providing a detailed outline. I’ve been away implementing this and looking at the right expressions to use to split/concatenate the data. I’ve managed to put the pipeline together however the Mapper snap isn’t returning any data based on the expression provided:
This is a copy of the JSON message before it goes into the Mapper. There is currently no data in the csv file hence the blank message on input0
[
{
“input0”: [
],
"input1": [
{
"A": "X",
"B": "X",
"C": "60",
"D": null,
"E": "X",
"F": "",
"G": "X",
"H": "X",
"I": "1320159",
"J": 1430047,
"K": "X",
"L": "X",
"M": "X",
"N": "X",
"O": false
}
]
}
]
01-20-2022 12:26 AM
If input0 contains the new data in your pipeline, you should write the following expression:
$input1.concat($input0)
This is working fine for me. Result:
[
{
"A":"X",
"B":"X",
"C":"60",
"D":null,
"E":"X",
"F":"",
"G":"X",
"H":"X",
"I":"1320159",
"J":1430047,
"K":"X",
"L":"X",
"M":"X",
"N":"X",
"O":false
}
]
01-20-2022 03:00 AM
Okay so we’re getting there.
I’ve re-configured the Mapper and applied a few other changes but now the pipeline is returning an error:
Stacktrace: Metadata failed to load for ‘insert file location here’
Resolution: Check for URL syntax and file access permission
I read another article on here and wonder if it has something to do with setting up an Account in the File Reader Snap using Basic Auth?
The file is situated in a folder in SnapLogic under my username.