input an array as filter to select rows in a table - field is a table reference

Options

I'm trying to passa an array as input to retrieve rows that contains my array.

1 - Scenario

DB.table.items_ref overlaps input(object[items]) »»»> Not working

2 - Scenario

DB.table.items_as_int_array overlaps input(integer[items]}) »»»> Working

The problem with secenario 2, is that I lost the benefit of the table reference. Is there any tips to having the scenario 1 working?

Tagged:

Best Answer

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Answer ✓
    Options

    For the effect you are going for, a simplifying route is to have a simple array of table references (which are just ints under the covers, but maintain your connection), rather than array of objects that each have a table reference member. The object throws up barriers to the select part of the query.

Answers

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    Hi @Rodrigo What are you comparing the items_ref with in the first scenario? I am not sure I understand input(object[items]) . Maybe you can share a screenshot?

  • Rodrigo
    Rodrigo Member
    Options

    Thanks for spend your time reviewing it @Ray Deck

    This is the scenario 2 I'm trying to do.

    {"message":"ParseError: "test_get_array_filter.items_from_ref" overlaps [{"items_id":1}], message=1st operand must be json or a scalar array."}

    This the scenario 1 that works - but I dont want use a simple integer Array w/o databse relantionship.

    The difference on the scenario 1 is that I'm passing a integer array and on the database side I've create another integer array.