cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Navigate through a megacollection containing Report Dataset content

FM_MEGA
Super Contributor

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?

2 Replies

PJBPascalBandet
Senior Member

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

pvandeginste
Honored Contributor

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

 

Thanks!