Accessing the values from a JS block in SQL

  1. My goal - I want to be able to access values output from a code block into a loop

    I have a code block called ExtractData which returns data like this:

    return {
    date_added,
    date_modified,
    id_efb_logflight: id,
    flight_date: start,
    aircraft,
    }

  2. Issue:

    How do I access these values in a loop block using SQL rather than GUI to access the data?

    I have tried ExtractData.value.date, value.date and a few other permutations, but nothing seems to work.

    Thank you.

    Jonathan

Hello @FlightLogistics! Welcome to the forums.

When you are setting up the loop block in a workflow you would access each member of the looping data with the {{ value }} property. For your data, using {{ value.date_added }} for the date_added value should have worked.

For clarity, are you returning the data with ExtractData as an array that you are then looping (ie. is ExtractData the source you use for the loop)?

Hi pyrrho. Thank you for your reply.

I’ve managed to get this working using a SQL update command using the method you suggested - value.

I am going to try to make a loop using SQL which uses ExtractData.data as the source and see if I can make that work as well.

Thank you for your help. My apologies for the delay in replying.

Best regards

Jonathan