Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
jeanphi45
Contributor
Contributor

tfileinputraw then tRest : in order to attach a pdf file in a couchdb

Hello ,
I try to attach a pdf file into a couchdb base.
First I use the tfileinputraw component with "Read the file as a bytes array"
After I want to use a tRest component.
Could you tell me what is the name of the variable which gives the content of the pdf file.
Thanks in advance
tFileInputRAw --> tRest
Labels (3)
5 Replies
jeanphi45
Contributor
Contributor
Author

What do I put in "Corps HTTP" to load the pdf file ?
Anonymous
Not applicable

Use a tFlowToIterate after the tFileInputRaw. This will store the byte array in the globalMap HashMap with the key "row.column" (replace row for the row name and column for the column name leaving the tFlowToIterate). Then connect from the tFlowToIterate to the tRest using the Iterate connector. Once this is connected, set the Http Body field to the value held by the globalMap. It will look something like below....
((byte[])globalMap.get("row.body"))

You will also need to set a header in the HTTP Headers section. The header name is "Content-Type" and the value will likely be "application/octet-stream".
This should work, but there is always a bit of jiggery pokery required when sending files via web service. 
Oh, the HTTP Method will likely be POST.
jeanphi45
Contributor
Contributor
Author

Anonymous
Not applicable

Did that not work? I am confused.
jeanphi45
Contributor
Contributor
Author

No no , it's works . Thanks