Skip to main content
Participant
January 25, 2023
Answered

I am wanting help with a form that I have made with my first time using a formula in calculate tab

  • January 25, 2023
  • 2 replies
  • 949 views

I have typed in a simplified field notation to calculate (LoanAmt+SeniorLien)/(ApprValue+ApprValue2)*100 This calculation is in a field named LTV I am trying to get it to calculate a loan to value but this field is giving me an error message if the fields for LoanAmt etc don't have a number in them. Error message is "The Value Entered Does Not Match The Format of the Field [LTV]" can someone help me fix this please. 

    This topic has been closed for replies.
    Correct answer Nesa Nurani

    That's because if ApprValue and ApprValue2 are empty it try to divide, but you can't divide with zero, so use this as custom calculation script:

    var f1 = Number(this.getField("LoanAmt").valueAsString);
    var f2 = Number(this.getField("SeniorLien").valueAsString);
    var f3 = Number(this.getField("ApprValue").valueAsString);
    var f4 = Number(this.getField("ApprValue2").valueAsString);

    if(f3||f4)
    event.value = (f1+f2)/(f3+f4)*100;
    else
    event.value = "";

    2 replies

    Nesa Nurani
    Community Expert
    Nesa NuraniCommunity ExpertCorrect answer
    Community Expert
    January 25, 2023

    That's because if ApprValue and ApprValue2 are empty it try to divide, but you can't divide with zero, so use this as custom calculation script:

    var f1 = Number(this.getField("LoanAmt").valueAsString);
    var f2 = Number(this.getField("SeniorLien").valueAsString);
    var f3 = Number(this.getField("ApprValue").valueAsString);
    var f4 = Number(this.getField("ApprValue2").valueAsString);

    if(f3||f4)
    event.value = (f1+f2)/(f3+f4)*100;
    else
    event.value = "";

    Participant
    January 25, 2023

    Oh My Gosh!!!! Nesa thank you so much, I have been trying to figure this out for several days working on it.

    kglad
    Community Expert
    Community Expert
    January 25, 2023

    in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

     

    p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post if it helps you get responses.

     

    <moved from using the community>

    Participant
    January 25, 2023

    I just tried that and It took me to the same place I just posted my question that you replied to