How to fetch only required fields from result

How to fetch only required fields from result based on input string parameter in gsql

Ex :
Input :
requiredFields = “id,name”

Query :
result= select v from start:v
print result

In above line, I want to display only fields which are in input param requiredFields.

print result[result.id, result.name];

2 Likes

Thanks for reply . I am looking for dynamic fields . I do not want to hardcode fields like this print result[result.id, result.name] in the query; .This will anyways work.

It should consider fields from input string parameter which is passed to the custom query . I am trying to implement custom gsql query for getting vertices .