get docuview from few projects

Hi,

i am trying to do this: i select few records in projtable and then press docuview, then i get all docs to list from that projects.

What i made now, it shows only the last project docs:

#localMacro.insertTmp

new OverwriteSystemfieldsPermission().assert();

docuRefTmp.overwriteSystemfields(true);

docuRefTmp.clear();

docuRefTmp.data(docuRefS);

docuRefTmp.(fieldnum(DocuRef, CreatedBy)) = docuRefS.createdBy;

docuRefTmp.(fieldnum(DocuRef, CreatedDateTime)) = docuRefS.createdDateTime;

docuRefTmp.Insert();

CodeAccessPermission::revertAssert();

docuRefTmp.overwriteSystemfields(false);

#endMacro

else if (CallerProjTable)

{

formDataSource = element.args().record().dataSource();

for(projTable = formDataSource.getFirst(true) ? formDataSource.getFirst(true): element.args().record();

projTable;

ProjTable = formDataSource.getNext())

{

while select docuRefS order by createdDateTime

where docuRefS.RefRecId == projTable.RecId

{

#insertTmp

}

}

}

can anybody help?