does my study table cell contain a structure and if so, what is the name?

I was recently using a study table and wanted to find out if a cell contained a structure and what the name of the structure was. I knew I could use the eval command to find out whether the cell contained a structure (by copying to an xsd and seeing if this worked). However, this is not a very elegant solution. A quick chat with my colleague Simon Gray revealed that the ->Name property might work on a study table cell containing a structure. Therefore, I wrote this bit of code which seems to be a quick fix to both of my problems....

my \$studyTable = \$Documents{"test.std"}; my \$numRows = \$studyTable->RowCount; my \$numColumns = \$studyTable->ColumnCount; # Go through each row and column in the study table for (my \$row = 0; \$row<\$numRows;++\$row) { for (my \$column = 0; \$column< \$numColumns; ++\$column) { # Define a variable to store a name my \$name; # Eval whether the column contains a structure eval{\$name = \$studyTable->Cell(\$row, \$column)->Name;}; if (\$@) { # Cell does not contain a document print "Cell \$row \$column does not contain a structure\n"; } else { # Cell contains a structure to work with print "Cell \$row \$column contains a structure called \$name\n"; } } }

This seems to work for my test study tables so thought I would share it.

Cheers

Stephen