Add measure from code

edited February 2011 in FastCube
Hello

I use free Turbo Delphi 2006. I create all fastcube objects at runtime (turbo delphi doesn't allow to add new components to components palette ).

All my code is above:


fcCube1 := TfcCube.Create(nil);
fcCube1.DataSet := ADataSet;

fcSlice1 := TfcSlice.Create(nil);
fcSlice1.Cube := fcCube1;

fcGrid1 := TfcGrid.Create(frmKostka);
fcGrid1.Parent := panGRid;
fcGrid1.Align := alClient;
fcGrid1.Slice := fcSlice1;

fcToolBar1 := TfcToolBar.Create(frmKostka);
fcToolBar1.Parent := panBar;
fcToolBar1.Grid := fcGrid1;

fcChart1 := TfcChart.Create(frmKostka);
fcChart1.Parent := panchart;
fcChart1.Slice := fcSlice1;
fcChart1.Align := alClient;

fcChartToolBar1 := TfcChartToolBar.Create(frmKostka);
fcChartToolBar1.Parent := panchart;
fcChartToolBar1.Chart := fcChart1;


fcCube1.Open;
fcGrid1.Active := True;
fcChart1.Active := True;


I need to have Count measure in measures list.

I add above code but no success - measure isn't on list

fcSlice1.BeginUpdate;
fcSlice1.Clear;
fcSlice1.AddFieldTo('Count', '', 'Count', rf_CapFacts, af_Count);
fcSlice1.EndUpdate;


Can You help me

Reagrds
Tygiel

Of course i use full version of FastCube

Comments

  • edited 11:35PM
    Hi.

    Your code is right.
    I test it in Delphi 7.

    Try add:
    fcSlice.AddFieldTo(sMeasuresFieldName,'',rf_CapXAx);
    after AddFieldTo

    Oleg Pryalkov.

  • edited 11:35PM
    wrote: »
    Hi.

    Your code is right.
    I test it in Delphi 7.

    Try add:
    fcSlice.AddFieldTo(sMeasuresFieldName,'',rf_CapXAx);
    after AddFieldTo

    Oleg Pryalkov.


    Thanks for reply, I found other solution: save cube schema with manually created measure and just load it when user create cube
    Regards

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.