How to calculate in databand ?

mohanarajmohanaraj 600001
edited 7:57PM 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 7:57PM
    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