I'm creating a display with some VBA code to import all datasets stored in all open PB displays.
I want to handle if any of the displays have datasets with the same name as any of the already imported datasets in my display, and rename the dataset if so. It's better to get everything, and then the user can review the imported datasets after.
I'm "For Each"-ing my way through all open displays, and all datsets, copying the datasets using the dataset.Copy(ThisDisplay) method. The problem is this method only copies datasets from one display to another, and returns an error if there's already a dataset defined with that name. My idea was to append a postfix to the name in the source display before using this method, but that doesn't seem to work. The "PI ProcessBook Programmer Reference Guide" help file says the Dataset Name Property is read/write, but when I try to rename a dataset in the source display before copying it I get an error message saying the "Dataset name is read only". I didn't test renaming a dataset in the same display as my VBA code run in, possibly I can only rename local datasets.
Any suggestions on how to finish this? Any way to copy a dataset into a local variable, and the create it in my display? (Datasets.GetDataset("Name") only seems to return a pointer to the dataset)
Of course I could just skip any datasets with matching names, but that's not very user friendly.