Posted 14 April 2024, 10:56 pm EST
Simple question I’d like to make a calculated field from 2 bound fields DataEntryOn and CheckedOn to display the time difference in the calculated field. But I keep getting stuck
Forums Home / ActiveReports / ActiveReports v7+
Posted by: kellison8 on 14 April 2024, 10:56 pm EST
Posted 14 April 2024, 10:56 pm EST
Simple question I’d like to make a calculated field from 2 bound fields DataEntryOn and CheckedOn to display the time difference in the calculated field. But I keep getting stuck
Posted 15 April 2024, 4:20 am EST
Hi Kurt,
You can either set the Detail Field value in the Standalone Designer something like:
Detail Field= =firstName + " " + lastName
Or you can use the OnFormat Event of the report section to set the value of the textBox. See sample code:
public void Detail_Format()
{
this.TextBox1.Value = double.Parse(rpt.Fields["field1"].Value.ToString()) + double.Parse(rpt.Fields["field2"].Value.ToString());
}
Please refer to the attached report.
Regards,
Akshay
EmployeeReport.zip
Posted 15 April 2024, 6:46 am EST
Akshay,
I appreciate the quick reply but
I was actually trying to make a calculated field to show the time difference between 2 datetime bound fields.
Posted 16 April 2024, 2:29 am EST
Hi Kurt,
Apologies for the inconvenience. It is not possible to subtract Date type Data Fields in a Calculated Field Formula.
I would rather suggest you to use a custom function and use Report Script to show time difference between two data fields.
Please refer to the attached sample.
SampleTimeDiff.zip