How to pass attribute names as parameter?

Hello all,
I would like to pass attribute names of a vertex as parameter in the query but shell is complaining about it. Is there a way to dynamically pass attribute names?

CREATE QUERY get_attr_stats(string VertexName, string attrName) FOR GRAPH TEST { 
MaxAccum<int> @@max;
MinAccum<int> @@min;
AvgAccum @@avg;
SetAccum<int> @@distinctVal;
ListAccum<int> @@numNulls;

VertSource = {VertexName.*};
results = SELECT s FROM VertSource:s
       ACCUM @@max += s.attrName,
             @@min += s.attrName,
             @@avg += s.attrName,
             @@distinctVal += s.attrName,
             IF s.attrName == 0 THEN
             @@numNulls += s.attrName END;
PRINT @@max, @@min, @@avg, count(@@distinctVal), count(@@numNulls);
PRINT now() as updated;


@eyeprem here are a few examples (below). The basics for passing a vertex are defined on item #2.

Running a query via HTTP request - complex parameter type
# 1. SET or BAG
CREATE QUERY RunQueryEx2(SET<INT> p1) FOR GRAPH testGraph{ .... }
# To run this query (either RUN QUERY or curl):
GSQL > RUN QUERY RunQueryEx2([1,5,10]) 
curl -X GET "http://localhost:9000/query/testGraph/RunQueryEx2?p1=1&p1=5&p1=10"
# 2. VERTEX.
# First parameter is any vertex; second parameter must be a person type.
CREATE QUERY printOneVertex(VERTEX va, VERTEX<person> vp) FOR GRAPH socialNet {
  PRINT va, vp;
# To run this query:
GSQL > RUN QUERY printOneVertex(("person1","person"),"person2")   # 1st param must give type: (vertex_id, vertex_type)
curl -X GET 'http://localhost:9000/query/socialNet/printOneVertex?va=person1&va.type=person&vp=person2'
# 3. BAG or SET of VERTEX, any type
CREATE QUERY printOneBagVertices(BAG<VERTEX> va) FOR GRAPH socialNet {
  PRINT va;
# To run this query:
GSQL > RUN QUERY printOneBagVertices([("person1","person"), ("11","post")])  # [(vertex_1_id, vertex_1_type), (vertex_2_id, vertex_2_type), ...]
curl -X GET 'http://localhost:9000/query/socialNet/printOneBagVertices?va\[0\]=person1&va\[0\].type=person&va\[1\]=11&va\[1\].type=post'
curl -g -X GET 'http://localhost:9000/query/socialNet/printOneBagVertices?va[0]=person1&va[0].type=person&va[1]=11&va[1].type=post'
# 4. BAG or SET of VERTEX, pre-specified type
CREATE QUERY printOneSetVertices(SET<VERTEX<person>> vp) FOR GRAPH socialNet {
  PRINT vp;
# To run this query:
GSQL > RUN QUERY printOneSetVertices(["person3", "person4"])  # [vertex_1_id, vertex_2_id, ...]
curl -X GET 'http://localhost:9000/query/socialNet/printOneSetVertices?vp=person3&vp=person4'

Reference link in docs:

Thanks for the response. But it looks like the documentation shows the ways to pass vertex. Is there an example of passing attribute?

Looking at your original post string attrName should work. Are you getting an error?

Yes. Please see the following error:

(10, 23) Error: 's.attrName' indicates no valid vertex type.
Possible reasons: 

- The expression refers to a primary_id, which is not directly
usable in the query body. To use primary_id, declare it as an 
attribute. E.g "CREATE VERTEX Person (PRIMARY_ID ssn string, ssn string, age int)"
- The expression has misspelled an attribute, or a vertex name