PML Customisation
User Guide
Control Logic
:
DO Loops
: DO INDEX and DO VALUES
DO INDEX and DO VALUES
DO INDEX and DO VALUES are ways of looping through arrays. Typically values are collected into an ARRAY variable then looped through using the following:
DO !X VALUES !ARRAY
!X takes each ARRAY element as its value
DO !X INDEX !ARRAY
!X is a number incremented from 1 to !ARRAY size
For example:
!siteCollection = object COLLECTION()
!siteCollection.type('SITE')
!allSites = !siteCollection.results()
do !site values !allSites
-- !site is the DBREF of a site element
q var !site.name
enddo
do !index index !allSites
-- !index is a number from 1 to the size of the !allSites array
q var !allSites[!index].name
enddo
1974 to current year.
AVEVA Solutions Limited and its subsidiaries. All rights reserved.