How to use delete or select statement inside ACCUM

Hi team
I have a use case where I have three “foreach” loop and one if condition inside accum and when I write (Select statement to delete the edge) inside last if condition giving me red line ,
can we can’t use the select or delete inside Accum?
ACCUM delete(edgealias) this one works fine if we are going to delete from the select-(then graph journey)… and if in accum inside foreach if we want to delete any edge other from this select journey then we require select statement or direct DELETE but both are giving me red underline

CREATE QUERY update_segment(String str) FOR GRAPH clientsgA_1 { 
   start = {Profile.*};
   profiles = select s from start:s  ACCUM
        IF s.@cv_segment.size() > 0 THEN 
           # Means tagged with Segment
           delete_edg = select p from start:p-(customer_cvsegment:e)- cv_segment:t WHERE p.customer_id == s.customer_id accum DELETE(e)
           #DELETE e FROM start:p -(customer_cvsegment:e)- cv_segment:t WHERE p.customer_id == s.customer_id,
           foreach profile_segment IN s.@cv_segment DO
               insert into customer_cvsegment(FROM, To) 
                          VALUES(s.customer_id, profile_segment)

I tried both way of deletion but giving me the error, when i install the query this one giving me please fix the error and when i removed this delete line code works perfect

You need to use POST-ACCUM instead of ACCUM.

Hi @wavedata The video linked below walks through ACCUM vs POST-ACCUM in detail. Let me know if you have any questions after watching the video.

ACCUM & POST-ACCUM Documentation