Skip to main content
Participant
January 24, 2024
Question

Help with Greater Than Formula in Acrobat Pro

  • January 24, 2024
  • 1 reply
  • 307 views
Hi everyone I need help with a simple formula for a score card. I need the formula to look at two scores, so H1 and A1. The greater of the two scores results to be awarded 1 point in the Home Reward / Away Reward columns. So for example below , the home player below scored 50 points. Away player scored 60 points. Away player gets rewarded with 1 point, whereas home player gets 0 reward. So whomever outscores their opponets gets 1 point for the win. But I also need to show that the opponent who lost the game gets 0. Home Player Home Points Home Reward Away Player Away Points Away Reward Home Name 50 (H1) 0 Away Name 60 (A1) 1 What would be the formulas for the Home Reward Field and then the same for the Away Reward Field ? The results will wil never be equal, one opponent will aways outscore the other, so one will always be greater or less (never equal) to the other score if that helps. Any help would be most appreciated.
    This topic has been closed for replies.

    1 reply

    Nesa Nurani
    Community Expert
    Community Expert
    January 24, 2024

    You can use this as a custom calculation script in one of the fields (make sure field names in script are correct):

    var h1 = Number(this.getField("H1").valueAsString);
    var a1 = Number(this.getField("A1").valueAsString);
    this.getField("Home Reward Field").value = (h1&&a1) ? (h1 > a1 ? 1:0) : "";
    this.getField("Away Reward Field").value = (h1&&a1) ? (h1 > a1 ? 0:1) : "";

    If you have more fields, it would be better to use loop to set all fields with one script, if you share your file or tell us how many fields you have and their names we can help.