nozzle collection error

Hi everyone,

created a macro to get output of nozzle

---------------------------------------------

VAR !NOZZ COLLECT ALL NOZZ WI (dbtype eq 'DESI')
--VAR !NOZZ COLLECT ALL NOZZ

VAR !PROJ PROJ ID
!outfile = object FILE (|c:\APPS\$!PROJ $C_NOZZ-ERR|)
!outfile.open(|OVERWRITE|)

!outfile.writerecord('SITE * ZONE * REF * TYPE * NAME * P1BORE * P1CONN * DUTY * CREF * CATREF * SPREF * DBNAME * DBFILE')
do !a from 1 to !NOZZ.SIZE()
$!NOZZ[$!A]
!SITE = NAME OF SITE
HANDLE ANY
!SITE = 'NULL'
ENDHANDLE
!ZONE = NAME OF ZONE
HANDLE ANY
!ZONE = 'NULL'
ENDHANDLE
!REF = REF
!TYPE = TYPE
!NAME = NAME
!P1BORE = P1BORE
HANDLE ANY
!P1BORE = !!error.text---------getting error on this line
ENDHANDLE
!P1CONN = P1CONN
HANDLE ANY
!P1CONN = !!error.text---------getting error on this line, as i would like to output the error code
ENDHANDLE
!DUTY = DUTY
--!SYSTEM_NO = ':SYSTEM_NO'
!CREF = CREF
!DBFILE = DBFILE
!DBNAME = DBNAME
!CATREF = NAME OF CATREF
HANDLE ANY
!CATREF = !!error.text
ENDHANDLE
!SPREF = NAME OF SPREF
HANDLE ANY
!SPREF = !!error.text
ENDHANDLE


--!outfile.writerecord(|$!SITE * $!ZONE * $!REF * $!TYPE * $!NAME * $!CATREF * $!SPREF * $!DBNAME * $!DBFILE|)
!outfile.writerecord(|$!SITE * $!ZONE * $!REF * $!TYPE * $!NAME * $!P1BORE * $!P1CONN * $!DUTY * $!CREF * $!CATREF * $!SPREF * $!DBNAME * $!DBFILE|)

ENDDO

!outfile.close()


$P ******** END OF REPORT ANB ********

--------------------------------------------------------------------

any guidance

  • and yes in the same macro how can we take UDA 

  • ...honestly, I would write this in PML 2. 

    -- can keep this
    VAR !NOZZS COLLECT ALL NOZZ WI (dbtype eq 'DESI')


    do !nozzle values !nozzs

    -- !nozzle is a STRING
    -- converting to DBREFerence
    !nozz = !nozzle.dbref() 

     !site = SITE of $!nozz 
     handle any 
         !site = 'NULL'
     endhandle
    -- zone same as site
     !ref = !nozzle

     -- now we'll ask all the info from the dbref object
     -- this is way faster as you don't actually need to CE the object 

    !type = !nozz.type
    !name = !nozz.name
    !duty = !nozz.duty
    !systemNo = !nozz.:SYSTEM_NO

    !dbname = dbname of $!nozz
    -- this will be a reference number mind
    !cref = !nozz.cref
    -- this will be a name
    !crefname = !nozz.cref.name
    -- names
    !catref = !nozz.catref.name
    !spref = !nozz.spref.name

    --- sometimes these *ref.name error out. I've no idea why. the fix is: 
    -- !cref = !nozz.cref
    -- !crefname = !cref.name

    -- Now, the bores; if you select the nozzle in the tree, and type q p1bore in the command line; 
    -- the answer you will get is something like Ppbore 700mm
    -- so to get the data; 
     !p1bore = !nozz.ppbore
    -- same experiment with p1conn, we get something like Ppconnect FGC
    !p1conn = !nozz.ppconnect

      --- SAVE TO FILE SAME AS YOU DID

    enddo 

    There you go. 
    Also, !!error.text() is a method as far as I remember, not an attribute, so to write it out you would need 
    !variable = !!error.text(), 
    not 
    !variable = !!error.text

    Hope I helped a little.. Note I didn't run this; so there are possible typos etc; please check. 

    enddo 

  • many thanks for looking at my query, i will run this & paste the output

    many thanks