Calculate a max value

Comments

1 comment

  • Avatar
    Aravind Rajanna

    Hello Yana,

    AgilePoint as helper methods to get the SubForm data. Please go through below documentation link for reference.

    https://documentation.agilepoint.com/00/appbuilder/cloudjsGetSubFormData.html
    https://documentation.agilepoint.com/00/appbuilder/cloudjsSetFieldValue.html

    Please find the below code snippet to get the latest date entered. Hope this help.

    function GetLatestDate()
    {
    var CompareDate ="";
    var LatestDate = "";
    var options = {};
    options.fieldId = 'SubForm1';
    eFormHelper.getSubFormData(options, function (result)
    {
    if (result.isSuccess)
    {
    $(result.data).each(function(i,v){
    CompareDate = v.Date;
    if(CompareDate>LatestDate)
    {
    LatestDate = CompareDate;
    }
    });
    }
    });
    SetFieldValue('HiddenDateField',LatestDate) // save the the latest date Entered in the form field and make it hidden.
    }


    function SetFieldValue(ControlId,Date)
    {
    var options = {};
    options.fieldId = ControlId;
    options.value = Date;
    eFormHelper.setFieldValue(options, function (result)
    {
    if (result.isSuccess) //check if is success
    {
    console.log(result.data); //logs the data holds empty object
    }
    });
    }


    Regards,
    Aravind Rajanna

    1
    Comment actions Permalink

Please sign in to leave a comment.