additionalScope and prepared statements not working

hallo @victoria

i have 2 query, one is sql query, one for js. they are like;

INSERT INTO mr_audit_log_retool (entity_id, 
                                 table_name, 
                                 field_name, 
                                 previous_value, 
                                 new_value,
                                retool_user)
VALUES
  ('{{table1.changesetArray[0].buchungId}}', 
   '{{mr_bookings.id}}', 
   {{ colName }}, 
   '{{table1.data.find(
  x=>x.buchungId === table1.changesetArray[0].buchungId)[Object.keys(table1.changesetObject[1])[0]]}}', 
   '{{table1.changesetObject[1].buchungEnde}}',
  {{ num }});

MySqlQuery.trigger({

  additionalScope: {

    num:1,
    colName: 'TEST'
  }
  
});

the problem i can not reach the declared variable in MySqlQuery. can you help to figure it out, please?

Hi @halil, it looks like you've set things up correctly!

Would you mind sharing the error message you're seeing? It would also be helpful to know whether or not prepared statements are enabled for this resource.

  • With prepared statements ENABLED you'll want to use {{ colName }}
  • With prepared statements DISABLED you'll want to use '{{ colName }}'
1 Like