Suggestion about tracking orders in SQL

Hey,
I understand.
Can someone help me: I have this expression that checks whether particular orderId is in array. If it is not, it is adding it. Is it possible, to additional trigger action that will call another function that will do some additional tasks (writes into the SQL DB).

(payload.orderId in $globalContext("array4")) ? $globalContext("array4"): $append($globalContext("array4"), [payload.orderId])

I think I solved it quite easily....

1 Like

I have additional question. I am receiving array in the following format.
In this secondary scenario I would like to save Pair names and not the values in the global array. How can I achieve that? With split function I can get each price and then write


to global array, but I would like to get pair names.
Thank you for the suggestion.

It will help me, if someone can instruct me, how can I get value "ETHBTC" or "LTCBTC" from this object? After that I will handle to write it to another array. Thank you in advance!

Javascript

let names = Object.keys(msg.payload);

JSONata

$keys($$.payload)

[edit] fixed typo

1 Like

E1cid,
Kudos to you! Today I already spent 2 hours trying to fins a solution....it was just partial solution, but then you provided 1 line solution that is doing exactly what I was looking for. Complements! Thank you.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.