Dear PML Expert,
Scope of the macro would like to be:
Read two external .txt files, ( tempA.txt ) (tempB.txt ) if thePIPENAME into tempA match with PIPENAME into tempB
then, I want to associate the OWNER from tempB with PIPENAME from tempA
The loop take to much type and duplicate the row, one whit OWNER and one without.
Appreciate any suggestion?
thx
******* FIRST STEP COLLECT ALL PIPE AND EXPORT INTO \XXXXX\tempA.txt *************
******* SECOND STEP COLLECT ALL GIPITEM AND EXPORT INTO \XXXXX\tempB.txt *************
FROM GIPITEM EVAL ---> attribute SItem = PIPE NAME
FROM GIPITEM EVAL ---> OWNER = NAME OF COLLECTION
******* THIRD STEP SPLIT INTO ARRAY \XXXXX\tempA.txt *************
!input = |C:\TEMP\PipeReports\tempA.txt|
!INPUTFILE = OBJECT FILE(!INPUT)
!LINES = !INPUTFILE.READFILE()
DO !N INDICES !LINES
!text = !lines[!n].trim()
skip if !text.unset() or !text eq '' or !text.MATCHWILD('*--*') or !text.MATCHWILD('UNIT')
!textA = !text.split(';')
--q var !textA
!!aZ = !textA[1] $* WBS
!!bZ = !textA[2] $* UNIT
!!cZ = !textA[3] $* PURP
!!dZ = !textA[4] $* ZONE
!!pipeB = !textA[5] $* PIPE
!!eZ = !textA $* FLUID
!!fZ = !textA[7] $* DIAM
!!gZ = !textA $* PSPEC
!!hZ = !textA[9] $* STATUS
!!iZ = !textA[10] $* REVISION
!!lZ = !textA[11] $* LOCK
!!mZ = !textA[12] $* DATE MOD
!!nZ = !textA[13] $* USER MOD
--ENDDO
******* FOURTH STEP SPLIT INTO ARRAY \XXXXX\tempB.txt *************
!input = |X:\E3D_ProjectsV3\ANG\ANG\ANGpmllib\design\function\DailyReports\tempB.txt|
!INPUTFILE = OBJECT FILE(!INPUT)
!LINEX = !INPUTFILE.READFILE()
DO !j INDICES !LINEX
!textx = !LINEX[!j].trim()
skip if !textx.unset() or !textx eq '' or !textx.MATCHWILD('*--*')
!textC = !textx.split(';')
!!pipeD = !textC[1].replace('/','')
!!wFM = !textC[2]
******* FIFTH STEP IF NAME OF PIPE ( tempB ) is EQ NAME OF PIPE ( tempA ) *****************
THEN EXPORT ROW WITH NAME OF PIPE ( tempB ) AND OWNER OF ( tempB )
IF !!pipeD eq !!pipeB THEN
--$P YES
VAR !OUTPUTA APPEND '$!!aZ;$!!bZ;$!!cZ;$!!dZ;$!!pipeB;$!!eZ;$!!fZ;$!!gZ;$!!hZ;$!!iZ;$!!lZ;$!!mZ;$!!nZ;$!!wFM'
ELSE
VAR !OUTPUTA APPEND '$!!aZ;$!!bZ;$!!cZ;$!!dZ;$!!eZ;$!!fZ;$!!gZ;$!!hZ;$!!iZ;$!!lZ;$!!mZ;$!!nZ;Null'
ENDIF
ENDDO
ENDDO
********* THIS IF TAKES TO MUCH TIME *********
THE LOOP IS NOT CORRECT ?