Iterate through the MapAccum

Is there anyway to iterate on the MapAccum? Said I have declared MapAccum<String, String> @@abc. How can I do FOREACH x IN @@abc DO …

Thank you,
Chau

Hi @chaunn2000

try with

FOREACH (mykey, myvalue) IN @@abc DO
// something
END;

https://docs.tigergraph.com/dev/gsql-ref/querying/control-flow-statements#foreach-statement

Best,
Bruno

2 Likes

Awesome! Thanks Bruno. Got it now.

Chau

1 Like

You can also do this inside the query, for instance in the POST-ACCUM clause, to iterate through a vertex attached MapAccum.