' Il seguente frammento, assegnato post attività, assegna alla attività nr. 2 i redattori della attività 1 e i responsabili dell’ente in CUSTOM3, nonché di tutti gli enti da cui questi dipendono
dim tipo, tipo_cont, numero as string
dim ind_rev as integer
UnPackCode("DW",CODDOC,tipo,tipo_cont,numero,ind_rev)
dim codam = New DBArray
codam = BPMWorkflowGetPersons(DB,tipo,tipo_cont,numero,ind_rev,ACTIVITY)
if formfields("CUSTOM3").value <> ""
Dim par As AssocArray = New AssocArray
par("COD")=left(formfields("CUSTOM3").value,formfields("CUSTOM3").value.indexof(" - "))
dim msg, sql as string
dim q1 as qwtable
sql = " with entiCTE AS "
sql += "(SELECT codice, ente_dip from enti where codice=:COD "
sql += " UNION ALL select e.codice, e.ente_dip from enti e join entiCTE ec on ec.ente_dip=e.codice) "
sql += " select codice as resp from person where (ente in (select codice from entiCTE) and resp=1) "
sql += " or (ente2 in (select codice from entiCTE) and resp2=1) "
sql += " or (ente3 in (select codice from entiCTE) and resp3=1) "
sql += " or (ente4 in (select codice from entiCTE) and resp4=1) "
sql += " or (ente5 in (select codice from entiCTE) and resp5=1) "
q1=OpenTable(DB,sql,par,false,false,msg)
if empty(msg) then
if q1.rowset.first()
do while not q1.rowset.endofset()
codam.add(q1.rowset.fields("RESP").value)
q1.rowset.next()
loop
end if
end if
CloseTable(q1)
end if
dim esito as String
esito=BPMWorkflowAddPersons(DB,tipo,tipo_cont,numero,ind_rev,2,codam,0)