Adding FastCube object in code

edited 10:54AM in FastReport 4.0
I have a tool that allows customers to design FastReports over one or more queries. When I create the report, the code does something like:
rptReport.Datasets.Add(rptDataset);

Everything works great, the user is able to select fields from each query - I don't allow them to add their own data sources within FastReport so the Data tab is blank (they can only with the queries that the tool has control over).

Now I want to enhance the tool to allow a FastCube to be designed over each query. Sometimes a customer might want to run the cube just by itself, but they might also want to embed it onto a report. There doesn't seem to be anyway to add the cube (really a TfcGrid with it's schema/slice that the user has already designed) to a report - I would like to do something like
rptReport.Cubes.Add(cubeReference);

...so the Cube reference will appear in the Cube combobox when they drop a TfrcCrossView object onto the report.

I tried to do something like this to "pre-create" the object on the data tab:
cubeView:=TfrcCube.Create(nil);
cubeView.Cube:=designedCube;
cubeView.Dataset:=rptDataset;
rptReport.Pages[0] as TfrxDataPage.Objects.Add(cubeView);

...but that causes an "Invalid pointer error". What can I do to get the Report designer to show a FastCube that has already been designed? FastReport VCL version 4.10.1, FastCube version 1.8.4.


Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.