Array with one element is interpolated without array

  • Goal:
    I expect [1] and {{[1]}} to be the same.

  • Steps:
    I have the follow GRPC API

service Admin {
  rpc DeleteUsers(UserIds) returns (google.protobuf.Empty);
}

message UserIds { repeated int32 user_ids = 1; }

And I'm trying using a multiselect row to fill the request body

{
  "user_ids": {{table.selectedRowKeys}}
}

If I select two rows it works, but if I select one row I receive the error:

message:"Error: 13 INTERNAL: Request message serialization failure: .retool.UserIds.user_ids: array expected"

If I write the id hard-coded it works too:

{
  "user_ids": [1]
}

But with {{[1]}} it doesn't work.

Hello @Guilherme_Salustiano!

Apologies for the issue. Given that you are able to hard code an array and have that work it sounds like the bug might be somewhere in the interpolation layer when the query is evaluating the {{ }} to generate the data.

I will look to reproduce this bug in a GRPC Query and to file a bug request.

In the mean time, my first thought would be to have a variable or JS query block that could run a ternary to convert single integers into an array containing that integer.