cancel
Showing results for 
Search instead for 
Did you mean: 

How to append filename with element from json?

2020
New Contributor II

Hi,
i`m trying the example pipeline named “test_JSON_Formatter”
Json generator → Mapper → Json Formater → File Writer

in Mapper i have:
Expression: _p_run_id.length != 0 ? $PAYLOAD.interface_id : $interface_id
Target path : $interface_id

in Json Formatter: i put nothing

In File Writer:

I want to append the filename with the content of the json element interface_id
i tried this c://temp//“test”+ $interface_id+“.xml”
but it returns error : interface_id is not defined
Where shoud i define the interface_id?
How snaplogic gets its content from the json?
Thank you

3 REPLIES 3

dimitri_hristov
Contributor

Hi @2020,

Should you try and add an entry in the Binary header properties section of the JSON Formatter Settings, like so:

json_formatter

then you should be able to use it in the File Writer, like so:

file_writer

Hope this helps.
BR,
Dimitri

dimitri_hristov
Contributor

Hi @2020,

To be fair, I tested the solution in my previous response by writing to sldb.

So I see now that the path in the File Name property in my response won’t work, because the format differs from the one in the example in the File Writer documentation.

I don’t have access to the Groundplex of the organization I used to test my answer. So I can’t test by writing the file that way.

As for the SMB protocol, I do use it in my work, but the path I use has a valid URL of a company server.

My guess is, when you are trying to write to the file system on the Groundplex, perhaps you lack permissions, or you maybe even have a stray quote sign in your path.

I’m sorry I can’t be of more help.

BR,
Dimitri

Thank you
it`s ok you can close this thread.