Calculated Field in report designer for section report

Posted by: kellison8 on 14 April 2024, 1:56 pm EST

    • Post Options:
    • Link

    Posted 14 April 2024, 1: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 14 April 2024, 7:20 pm 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 14 April 2024, 9:46 pm 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 15 April 2024, 5:29 pm 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

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels