cancel
Showing results for 
Search instead for 
Did you mean: 

Navigate through a megacollection containing Report Dataset content

Contributor

Navigate through a megacollection containing Report Dataset content

I want to export report dataset content into excel using only Java. From the documentation I found a way to get the report dataset content into a megacollection like this -

MegaObject mgobjDataSubSet = megaRoot.getCollection("~)ilXTIGrKPiB[Report DataSet]").get(datasetId);

MegaCollection mgcolDataSubSetValues = mgobjDataSubSet.getCollection("~Yvazr2mvKf21[DataSet Create]");

 

How can I iterate through this collection to get the short names of all the objects in this collection?

Tags (3)
2 REPLIES
Highlighted
Frequent Contributor

Re: Navigate through a megacollection containing Report Dataset content

Does anyone have any insights into this? Is it possible to use the java API to extract an existing report dataset to Excel?

 

Thanks!

Senior Member

Re: Navigate through a megacollection containing Report Dataset content

After some trial and error, I found out that you can access the content by using the absid of the definition item to retrieve values in each row.

The value you get is the absid of your object, which you can then lookup using GetObjectFromID:

 

' grab the dataset 
rds = GetObjectFromID("XXXXXXXXX")
' grab its definition
rdsdef = rds.GetCollection("Report DataSet Definition").Item(1)
struct = rdsdef.GetCollection("Report DataSet Structure").item(1)
columns = struct.GetCollection("Report DataSet Item")

' generate 
rows = rds.getCollection("~Yvazr2mvKf21[DataSet Create]", "order")
print "Found " & CStr(rows.Count) & " rows and " & CStr(columns.Count) & " columns."
' iterate and display all columns
for each row in rows
	print "-------"
	for each col in columns
		colname = col.GetProp("Short Name")
		colkey = "~" + col.getProp("Absolute Identifier")
		value = row.getProp(colkey)
		print colname & ": " & CStr(value)
	next
next