Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Engineering

DO INDEX and DO VALUES

  • Last UpdatedOct 24, 2022
  • 1 minute read

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

Related Links
TitleResults for “How to create a CRG?”Also Available in