Forum Discussion

PedroZepeda's avatar
PedroZepeda
Qrew Member
4 months ago

Pipeline - Make a Request - Api_Doquery get results and copy in a table using JINJA

Hello, this is my first time here. I was wondering if somebody can help me with a Pipeline, Make a Request (Api_DoQuery)

a. Search Records

b. Make a Request (Api_DoQuery - Method: POST - Content Type: Application/JSON
the output in Activity Log shows what I need (current_record_qf)

content:<?xml version="1.0" ?> <qdbapi> <action>API_DoQuery</action> <errcode>0</errcode> <errtext>No error</errtext> <dbinfo> <name>Subunit Goals</name> <desc></desc> </dbinfo> <variables> </variables> <chdbids> </chdbids> <record rid="80"> <current_record_qf>184,104.0080 ; 210,384.1373 ; 227,928.3268 ; 219,168.3467 ; 219,912.3468 ; 220,584.3469 ; 221,327.3470 ; 222,047.3471 ; 222,791.3472 ; 223,511.3473 ; 224,255.3474 ; 224,999.3475 ; 225,719.3476 ; 226,463.3477 ; 227,184.3478 ; 228,360.3663</current_record_qf> <update_id>1756412052839</update_id> </record> </qdbapi>

Then I have a CREATE A RECORD with the following jinja.
FIELD
{{b.json.qdbapi.current_record_qf}}

It is creating a record on the table but it is not passing the value into the field.

Am I missing something? I will appreciate any suggestion please?

2 Replies

  • You are close; however, it doesn't appear you are referencing the json response.  The data you pasted looks like the output content.  In the output of your Make Request step, scroll to the bottom and to the json node.

    This will show you the json data and help you determine the correct path for the field data.  

    Based on the screenshot attached, I used the following to get the customer_name value to pass in the create record step.  For demo purposes, I used record[0] to get the first record of the response.  If your data returns multiple records and you need to create a record for each one, you need to implement a loop within the jinja.

    {{c.json.qdbapi.record[0].customer_name}}