--Macro: find history of creation and modifying
--Author: Sergey Lebedev, 2005
var !hist split(history)
var !cedb dbname
!cenam = !!ce.type + ': ' + !!ce.name
!dbo = object db(!cedb)
!atts = object array()
!outputa[1] = 'History ' + !cenam
!outputa[2] = 'Type;Refno;Author;Date;Changed att'
do !x from 1 to !hist.size()
var !modat attmodlist $!hist[$!x]
!modatar = !modat.split()
!atts.appendarray( !modatar )
enddo
!atts.sortunique()
!unsetind = !atts.findfirst('unset')
!atts.remove(!unsetind)
--$p ce: $!cenam
do !x from 1 to !hist.size()
!sesn = !hist[!x]
!auth = !dbo.session($!hist[$!x]).author
!date1 = !dbo.session($!hist[$!x]).date
--!dateRUS = !!aereturnrusdatefull(!date1,'2')
!modatt = ''
do !y from 1 to !atts.size()
var !athist split ( history $!atts[$!y] )
handle (2,201)
skip
endhandle
if (!athist.size() geq 1 and !x neq !hist.size()) then
do !z from 1 to !athist.size()
if (!sesn.string() eq !athist[!z].string()) then
!modatt = !modatt + !atts[!y] + ' '
endif
enddo
endif
enddo
if (!x eq !hist.size()) then
!rev = 'created:'
else
!rev = 'revised:'
endif
--!outputa.Append(!REV + ';' + !SESN + ';' + !AUTH + ';' + !dateRUS + ';' + !MODATT)
!outputa.Append(!REV + ';' + !SESN + ';' + !AUTH + ';' + !date1 + ';' + !MODATT)
enddo
!tempfolder = 'C:\temp\pdms\'
!foldof = OBJECT FILE(!tempfolder)
if (!foldof.Exists().Not()) then
SYSCOM 'MKDIR $!tempfolder'
endif
!tempfile = !tempfolder + 'allhistoryinfo.csv'
!fileof = OBJECT FILE(!tempfile)
!fileof.Writefile('OVERWRITE',!outputa)
SYSCOM | $!tempfile & |