Something like OnGetText

Hi,

I'm trying FastCube.

I have a cube with a time (seconds) column used in summaries.
I'd like to show these values as string (for example 5400 seconds becomes 1h30m).
I apply this conversion only in visualization even when showing totals.
To do this with datasets I usually use OnGetText, but FastCube seems to ignore OnGetText.
How Can I do this with FastCube?

Thank you in advance.

Massimiliano Trezzi

Comments

  • edited 2:39AM
    Hi.

    Use custom format (type fkCustom)
    You can to create and registrate custom formates (fcCustomFormats.AddFormat).
    See examples fcExamples.

    Oleg Pryalkov.
  • wrote: »
    Hi.

    Use custom format (type fkCustom)
    You can to create and registrate custom formates (fcCustomFormats.AddFormat).
    See examples fcExamples.

    Oleg Pryalkov.

    Hi, Is it possible to do the same on dimensions?
    I have tried but costum format doesn't seem to work on dimensions.
    This is what I tried:
    res := fcCustomFormats.AddFormat('myFormat', 'myFormat', myFormat1Proc, '');
    
    for i := 0 to fcSlice1.FieldsOfRegion(rf_CapYAx).Count - 1 do begin
      fcSlice1.FieldsOfRegion(rf_CapYAx).Items[i].DisplayFormat.Kind := fkCustom;
      fcSlice1.FieldsOfRegion(rf_CapYAx).Items[i].DisplayFormat.FormatStr := 'myFormat';
    end;
    
    function myFormat1Proc(AValue: Variant; ADecSeparator: String): TfcString;
    var
      s: string;
    begin
      s := AValue;
      Result := s + '_mySuffix';
    end;
    
  • edited March 2011
    1.
    Edit in fcCube.pas:
    function TPCharArray.GetCaption(AIndex: Integer): TfcString;
    begin
      if IsNull[AIndex] then
        Result := FHash.FCube.NullStr
      else if FList[AIndex].Caption = nil then
        Result := FDisplayFormat.FormatData(TfcString(PAnsiChar(FList[AIndex].Value)))
    //    Result := TfcString(PAnsiChar(FList[AIndex].Value))
      else
        Result := FList[AIndex].Caption;
    end;
    

    and
    function TPWideStringArray.GetCaption(AIndex: Integer): TfcString;
    begin
      if IsNull[AIndex] then
        Result := FHash.FCube.NullStr
      else
      if FList[AIndex].Caption = nil then
        Result := FDisplayFormat.FormatData(WideString(PWideChar(FList[AIndex].Value)))
    //    Result := WideString(PWideChar(FList[AIndex].Value))
      else
        Result := FList[AIndex].Caption;
    end;
    


    2.
    Use:
    if (fcSlice1.FieldsOfRegion(rf_CapYAx).Items[i].SliceField <> nil) and (fcSlice1.FieldsOfRegion(rf_CapYAx).Items[i].SliceField.CubeField <> nil) then
    begin
      fcSlice1.FieldsOfRegion(rf_CapYAx).Items[i].SliceField.CubeField.DisplayFormat.Kind := fkCustom;
      fcSlice1.FieldsOfRegion(rf_CapYAx).Items[i].SliceField.CubeField.DisplayFormat.FormatStr := 'myFormat';
    end;
    
    Oleg Pryalkov

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.