Select between two query outputs in javascript query

I have a query to a PostgreSQL database that depends on a value. If that value is null I want to select the output of a different PostgreSQL query.

My code is as follows,

if (ValueToCheck.value != null) {
  return Query1.trigger();
} else {
  return Query2.trigger();
}

In the preview pane I see the result but when I access the .data accessor of the javascript query I get null.

Any clue how I could solve this?

@ant0n Can you post a screenshot of what you have written to access the data?
Or post code.
And also the result of the query1/query2? are you storing the result in a table? Some other field?
It may be as simple as yourjavascriptqueryname.data['0'] but hard to day without more information

the two queries are along the lines of

select countries.name from countries

I'll test with .data['0'] accessor. Thanks!

Hey @ant0n could you send a screenshot of the state panel on the left side of your screen with your query selected and the data portion expanded so we can take a better look at how your data is formatted and how to access it? Thank You!