Skip to main content
Known Participant
April 1, 2023
Answered

ja script count text

  • April 1, 2023
  • 2 replies
  • 1925 views
good morning, I'm looking for help to count the text "SI" which is repeated in many modules. modules call "operations1", "operations2"...etc
Thank you

 

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

    As 'Custom calculation script' of field where you want to show number of "SI" use this:

    var total = 0;
    for( var i=1; i<=11; i++){
    if(this.getField("operations"+i).valueAsString == "SI")
    total++;}
    event.value = total;

    2 replies

    Nesa Nurani
    Community Expert
    Community Expert
    April 1, 2023

    "operations1", "operations2"...etc are text fields?

    How many fields are there?

    Is "SI" the only word that will be in those fields?

    Known Participant
    April 1, 2023
    • "operations1" "operations2" etc...  yes
    • Yes, "SI" is the only result.
    • The fields are 11

    Thanks

    Nesa Nurani
    Community Expert
    Nesa NuraniCommunity ExpertCorrect answer
    Community Expert
    April 1, 2023

    As 'Custom calculation script' of field where you want to show number of "SI" use this:

    var total = 0;
    for( var i=1; i<=11; i++){
    if(this.getField("operations"+i).valueAsString == "SI")
    total++;}
    event.value = total;

    Ged_Traynor
    Community Expert
    Community Expert
    April 1, 2023

    @Frell29189474k2dv can you tell us which Adobe application you're using so we can move the thread to the correct forum

    Known Participant
    April 1, 2023

    ACROBAT

    Ged_Traynor
    Community Expert
    Community Expert
    April 1, 2023

    Thanks, I'll move the thread for you