How to pass multiple vertexes as parameters into queries

I can’t find the source at the moment, but I saw (or heard) that using the syntax below we can pass one or more vertexes into a query:

CREATE QUERY GetUserEvents(vertex<User> inputUser) FOR GRAPH MyGraph {

Note: This does not say “GetUserEvents(STRING userIDs)”, where I could pass in something like this: “1,2,3”.

But for “GetUserEvents(vertex inputUser)” I interpret this as expecting one or more vertex objects of type User. However, when I run this in GraphStudio I’m prompted for a Vertext id. In this case GraphStudio will accept in input value of “1” but not “1,2,3”.

Questions:

  1. Did I misunderstand that “(vertex inputUser)” can accept multiple vertexes?

  2. If it can accept multiple vertexes, how do we do this?

Thank you.

You are very close. If you need to pass a set of vertices, then use the set parameter syntax. Something like this. Note I’ve defined the type for the vertex too here:

CREATE QUERY GetUserEvents(SET <VERTEX<User>> inputUser) FOR GRAPH MyGraph {

Here are a bunch of examples: https://docs.tigergraph.com/dev/gsql-ref/querying/query-operations#complex-type-parameter-passing

That worked perfect and the link is very helpful. Bookmarked… Thank you.