If I want to reuse this variable in multiple iterations, how do I reset it so that I can add new vertices and keep track of the minimum vertex?
If you mean a FOREACH
or WHILE
loop when you say “iteration”, then yes, there is a way.
You can use = with most accumulators to assign it to a specific value, instead of doing accumulation with +=.
WHILE true LIMIT 10 DO
myMinAccum = GSQL_INT_MAX;
// or some other big number that is definitely bigger than any number in your application
<Do your stuff, including accumulation to myMinAccum>
END
1 Like
I want to do this for MinAccum<VERTEX> - So presumably i need to initalize it with a hypothetical vertex with maximum internal ID. This does’nt seem possible so far.
So, the easiest way to do this (that I can think of) is to use the integer equivalent of the vertex id. This is done with the getvid() function. See here for an example : https://docs.tigergraph.com/dev/gsql-ref/querying/operators-functions-and-expressions#getvid