601,100
562,"CHARACTERDELIMITED"
586,"C:\Temp\attachList.txt"
585,"C:\Temp\attachList.txt"
564,
565,"hdlITYA=aXVZ0>^Uf9^=h95`T[?@`mW@^D@dP1qeGChysxRHEG^t7rOzUyu44xJl@N209kEc1Lwprgy]sfWi2XKu^Ei>BVa\rTR;[AlP@TDNto7c=\gHQNj1xKdMbbhfxP6f\lY=>;q[i@pyQ32[UQ^I;1cP@6vjuNVyhqFvXOhlwCWf\:;au\xNR\bkOj0^47p]Uz]>"
559,0
593,
594,
595,
597,
598,
596,
800,
801,
566,0
567,","
588,"."
589,","
568,""""
570,
571,
569,0
592,0
599,1000
560,1
pSourcefile
561,1
2
590,1
pSourcefile,""
637,1
pSourcefile,Please enter source file name
577,13
vPlan
vVersion
vTask
vAttachmentIndex
vAttachType
vName
vPath
vCount
vCreatedBy
vCreatedDatetime
vSize
vFileType
vDescription
578,13
2
2
2
2
2
2
2
2
2
2
2
2
2
579,13
1
2
3
4
5
6
7
8
9
10
11
12
13
580,13
0
0
0
0
0
0
0
0
0
0
0
0
0
581,13
0
0
0
0
0
0
0
0
0
0
0
0
0
582,13
VarType=32	ColType=827	
VarType=32	ColType=827	
VarType=32	ColType=827	
VarType=32	ColType=827	
VarType=32	ColType=827	
VarType=32	ColType=827	
VarType=32	ColType=827	
VarType=32	ColType=827	
VarType=32	ColType=827	
VarType=32	ColType=827	
VarType=32	ColType=827	
VarType=32	ColType=827	
VarType=32	ColType=827	
572,5

#****GENERATED STATEMENTS START****
#****GENERATED STATEMENTS FINISH****

DATASOURCENAMEFORSERVER =  pSourcefile;
573,3

#****GENERATED STATEMENTS START****
#****GENERATED STATEMENTS FINISH****
574,39

#****GENERATED STATEMENTS START****
#****GENERATED STATEMENTS FINISH****

##Check every task attachment in the source file, 

vTasksDim = '}sm_versiontasks@' | vPlan | '@' | vVersion;

if (DimensionExists(vTasksDim) =1);
vTasksIndex = DIMIX(vTasksDim, vTask);

##If the task has been removed from the task dimension, delete all its attachments
if (vTasksIndex = 0);
   if (vAttachType @='BLOB');
        vFile = vPath | '.blb';
         if (FileExists(vFile)=1);
             ASCIIDelete(vFile);
          endif;
   endif;

else;
##if a task is not deleted
##add all its attachment information back to the cube
##This is a workaround to add consolidated element information back
vCubeName = '}ElementAttachments_}sm_versiontasks@' | vPlan | '@' | vVersion;
CELLPUTS(vAttachType, vCubeName, vTask, vAttachmentIndex, 'Type');
CELLPUTS(vName, vCubeName, vTask, vAttachmentIndex,  'Name');
CELLPUTS(vPath, vCubeName, vTask, vAttachmentIndex, 'Path');
CELLPUTS(vSize, vCubeName, vTask, vAttachmentIndex, 'Size');
CELLPUTS(vFileType, vCubeName, vTask, vAttachmentIndex, 'File Type');
CELLPUTS(vCreatedBy, vCubeName, vTask, vAttachmentIndex, 'Created By');
CELLPUTS(vCreatedDatetime, vCubeName, vTask, vAttachmentIndex, 'Created Datetime');
CELLPUTS('1', vCubeName, vTask, vAttachmentIndex, 'Counts');
IF (ELLEV(vTasksDim, vTask) = 0);
CELLPUTN(1, vCubeName, vTask, vAttachmentIndex, 'Count');
ENDIF;

endif;
endif;
575,3

#****GENERATED STATEMENTS START****
#****GENERATED STATEMENTS FINISH****
576,CubeAction=1511	DataAction=1503	CubeLogChanges=0	
638,1
804,0
900,
901,
902,
903,
906,
907,
908,
904,0
905,0
909,0
910,0
911,
912,
913,
914,
915,
916,
