Loop-Over-Objects-Doc
Last Update: 11/18/2024
The document command can be used for looping over objects. The -e switch allows for the user to specify the object to loop over. The -ef switch restricts the loop to the current folder.
This example loops over all Workbooks and then all Worksheets (Layers) and then picks up a particular row of a column with a particular long name:
// Loop over all books doc -e W { // Put book name into a string variable - could just use %h book$ = %h; type "Book is: %(book$)"; // loop over all sheets doc -e LW { // Put sheet name into variable sheet$ = layer.name$; type "Sheet is: %(sheet$)"; // (Re)Define a range to point to the column with long name // "system pressure" range r = [%(book$)]%(sheet$)!col(system pressure); // Get row 5 of col "system pressure" of current sheet of // current book double d = r[5]; // check if missing value if( d != 0/0 ) type "system pressure row 5 = $(d)"; } }
Keywords:page, layer, column, row, folder, worksheet, workbook, matrix