I figured it out. You have to use ThisDisplay.Datasets.GetDataset instead of ThisDisplay.Datasets.Item. Also, PI created duplicates of all my datasets (still haven't figured that one out) so calling, e.g., GetDataset("DSN_FOO") would only retrieve one of them. To loop through all datasets, I had to reference them by integers.