CREATE QUERY account_matchingv3(vertex<AM_CUSTOMER> input_acc, String str) FOR GRAPH retail_graph {
/* Write query logic here */
start = {input_acc};
JSONOBJECT jsonobj;
JSONARRAY arr;
jsonobj = parse_json_object(str);
arr = jsonobj.getJsonArray("vertex_weights");
foreach i in range[0, arr.size()-1] DO
#PRINT arr.getJsonObject(i).getString("name");
# this name contains "AM_EMAIL"
attributes = SELECT t FROM start:s-(:e)-arr.getJsonObject(i).getString("name"):t;
end;
}
In the above code im getting errror on this line
“arr.getJsonObject(i).getString(“name”)”
how to pass the target vertex name dynamically in tigergraph ?
below my requested input for str
{"vertex_weights":
[{"name": "AM_EMAIL",
"weight": 0.6},
{"name": "AM_CONTACT",
"weight": 0.6},
{"name": "AM_ADDRESS",
"weight": 0.3}],
"attributes_weights":
[{"name": "first_name",
"weight": 0.2},
{"name": "last_name",
"weight": 0.2},
{"name": "dob",
"weight": 0.2}
]
}