How do I do calculated fields on the server of a record being created or updated?

How do I do calculated fields on the server of a record being created or updated?

mike92117mike92117 Posts: 40Questions: 12Answers: 1

I have a very simple table with a few fields. The table has another six or so fields that are calculated on the server and saved as part of a record being created or updated. The calculated fields do not need to be returned to the client, though they can. However, they do need to be calculated on the server and some fields involve numerical methods. These are very fast running. However, I'm unsure how to do this or hook into this with datatables. The DTO class contains all edited fields and all calculated fields. The calculations could be done via a method that returns an instance of the DTO with the calculated fields. i.e, dto = GetCalcValues(dto).

I'm using the .net code for the table that looks like this:

using (var db = new Database(dbType, dbConnection))
{
    var response = new Editor(db, "J")
        .Model<DTO>()
        .Field(new Field("Re")
            .Validator(Validation.Numeric())
        )
        .Field(new Field("J")
            .Validator(Validation.Numeric())
        )
        .TryCatch(false)
        .Process(Request)
        .Data();
    return Json(response);
}

This question has an accepted answers - jump to answer

Answers

Sign In or Register to comment.