I am creating a report that is going to use a dataset for a multipage table.
I want the user to click a button on the page with a report viewer to have the client run a script that creates the dataset then runs the report. (I may have multiple values for the same cells in the dataset and I want the script to figure out which value to use.)
So I think the best way is to have a dataset tag that gets populated with all my values. The script should assume that its possible for the tag data to have any number of rows and for the previous column names to have changed. (The best way to beat Murphy’s Law is to assume it.)
I see three ways to do this.
- Remove the Tag, Recreate the Tag empty, and fill the Tag.
- Clear all the rows with system.dataset.deleteRows() and test that the headers match what should be there with system.dataset.getColumnHeaders(dataset).
- Create a new dataset altogether using system.dataset.addColumn() and a literal dataset that is blank.
However, I see problems with all three of those.
For 1) I think removing the tag and adding it again could create a lot of extra pointers and stuff behind the scenes in the Tag Provider that doesn’t all get deleted. I could be wrong about that, I just don’t know.
For 2), the script will not always know how many rows there are, and I couldn’t find a function that would tell me. (I tried len() but got an error, that dataset doesn’t have a len attribute or something.)
3 is probably the simplest solution but I don’t know how to create a literal dataset.
(What I mean by literal dataset is like a blank literal string (ie “”) or a blank literal list (ie []))
Anyone have any ideas or comments?