[BUG. IGN-1426] system.report.getReportNamesAsDataset() formats report path incorrectly

I noticed this behavior when importing reports and a viewer screen vision window from a 7.9.12 project into an 8.1.1 project. It appears that the ‘Text’ column value is concatenated into the ‘Path’ value, such that if the results are pulled into a tree view component, each report item actually appears like a folder, with a copy of itself (with an improperly extended/duplicated path) as the underlying node.

In the 7.9.12 project, I have the following structure of reports:
image
Then on the reporting viewer window, the root container has this custom method, which the tree view .items property is bound to:

	## Get all the configured reports as a dataset
	dataset = system.report.getReportNamesAsDataset('Line_Integration')
	## Build a new dataset using the dataset headers, but only keep reports in the 'Production/' folder
	data = system.dataset.toPyDataSet(dataset)
	headers = system.dataset.getColumnHeaders(dataset)
	rows = []
	for row in data:
		rowData = []
		if row['Path'].startswith('Production/'):
			for header in headers:
				rowData.append(row[header])
			rows.append(rowData)
	reportDataset = system.dataset.toDataSet(headers, rows)
	return reportDataset
	

And the resulting tree view looks as it should:
image

But in the 8.1.1 project, the same window and bindings come up like this:
image
This causes the report viewer, which I have bound to the selectedPath of the tree view, to not work properly.

I’ve managed to work around this for now by manually stripping the report name (‘Text’) from the end of the path

for row in data:
	path = row['Path']
	if path.endswith(row['Text']):
		path = path.replace(row['Text'], "")

I’ve tested with a different project running on 8.0.14 and I get the same behavior. I haven’t tested with any other versions.

I think this isn’t a change in the scripting function so much as the change in how resources are stored. In 7.x, the name of a resource was store separately from the rest of the path, and the scripting function returned those two separate parts to you.

In 8.x, the name of the resource is part of the path, which is what you’re getting returned.

I can see an argument for both ways – I’ll file a ticket asking to add an option to chose, since we can strip out the last element of that path before returning it to you. (You can also do this in Jython yourself, but obviously it’s easier to just add a Boolean param to your scripts.)

I can see how there would exist situations where someone would need the resource name included in the path, but the script function in this case appears to be designed to return a dataset compatible with a tree view, given the column names returned by the function.

Like you said, easy enough to script out the last part of the path, but having the parameter in the script would allow users to cover both use cases and would make my implementation cleaner across versions.