BinaryData: IAdhocBinaryData;
The BinaryData property returns dashboard binary data.
Binary data is used to store images contained in the dashboard. It enables the user to work with the dashboard by means of web services.
The object navigator displays dashboard binary data as child objects of the Document type.
Executing the example requires that the repository contains a dashboard with the ADHOC_REPORT identifier containing images.
Add links to the Adhoc, Io, Metabase system assemblies.
Sub UserProc;
Var
mb: IMetabase;
report: IAdhocReport;
i: Integer;
bindat: IAdhocBinaryData;
File1: IFileInfo;
BinW: IBinaryWriter;
AdhocBinItem: IAdhocBinaryItem;
Begin
mb := MetabaseClass.Active;
// Get dashboard
report := mb.ItemById("ADHOC_REPORT").Open(Null) As IAdhocReport;
// Get dashboard binary data
bindat := report.BinaryData;
// Save binary data to the file
For i := 0 To bindat.Count - 1 Do
AdhocBinItem := bindat.Item(i);
File1 := New FileInfo.Attach("c:\Image_" + i.ToString + ".jpeg");
BinW := File1.OpenBinaryWriter(True);
AdhocBinItem.Type := AdhocBinaryType.Jpeg;
AdhocBinItem.WriteToStream(BinW.Stream);
End For;
End Sub UserProc;
After executing the example all images contained in the dashboard are saved to the local C drive as files. File name format: Image_N.jpeg, where N is a sequence number of image.
See also: