How to calculate in databand ?

mohanarajmohanaraj 600001
edited 9:20AM in FastReport .NET
Hello,

I want display the data by after some calculation in the databand.

In the databand i give [SecondsToHHmmss([dtOrgsummary.TI/C])] for the text object, while run the report it throw an error as Specified cast is not valid.

in this [dtOrgsummary.TI/C]---- data source field which this in the Int32 datatype.
and the function SecondsToHHmmss as follows

private string SecondsToHHmmss(int seconds)
{
int hours = seconds / 3600;
seconds = seconds - (hours * 3600);
int minutes = seconds / 60;
seconds = seconds - (minutes * 60);
return String.Format("{0:00}:{1:00}:{2:00}", hours, minutes, seconds);
}


where the function also accept the int as parameter. my data field also in Integer.

i can't get, where i was wrong.

Comments

  • edited 9:20AM
    Hello,

    The dtOrgsummary.I/C column has decimal data type (in .xml data file). In a report, the DataType property of the column is set to Int32 which is not correct. You should set it to Decimal and use the following form:
    [SecondsToHHmmss(ToInt32([dtOrgsummary.I/C]))]

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.