Number in event.value script format

I have a script that retrieves data from a numeric field (r18) then add a space and the text "annual vacation Credits."  Currently, the result is something like "100000 credits of annual vacation.

I am trying to format the number to include if necessary comma (ex: 10,000 or 100 000 or 1 000 000 etc.).

Here is the current script:

Get the field values as strings

var = getField R18

.valueAsString ("r18");

Combine values

Event.Value = r18 + 'annual vacation Credits ".

Any help is appreciated

It is possible to format numbers and dates using the util object in Acrobat JavaScript.

Get the value of the field;
R18 var is getField ("r18") .value;.
formatting the value and concatenate text
Event.Value = util.printf ("%, 0 1.2F", r18) + 'vacation Credits. "

or

Get the value of the field;
R18 var is getField ("r18") .value;.
format, including the text value;
Event.Value = util.printf ("%, 0 1.2F annual vacation credits", r18);

Tags: Acrobat

Similar Questions

  • Number as currency within a format string values

    I used this script to make the entries in a text field and format in paragraph form.

    Get the field values as strings

    var d1 = getField("d1").valueAsString;

    var d9 = getField("d9").valueAsString;

    var totalcommission = getField("totalcommission").valueAsString;

    Combine values, separated by a space

    Event.Value = "we agree pay the participating dealer," + d1 + "and" + d9 + ", a commission for a amount of:" + totalcommission + "."; "."

    Everything works fine except the format of the field 'totalcommission '.  The result is currently "we agree pay the participating dealer, x and x, a commission for a amount: 10000."  I need this sentence at the end of "the sum of $10, 000.00.  The totalcommission field can vary in amount from as little as $50 to $ 10,000 (always USD).  Any help is appreciated.

    Chang, the last line to:

    event.value = "We agree to pay the participating broker(s), " + d1 + " and " + d9 + ", a commission in the amount of: $" + util.printf("%,0.2f", Number(totalcommission)) + ".";
    
  • How script: if (1-5 = "S/o" field) event.value = "N/a".

    I am
    still learn and I have a script as follows:

    var
    Totally = 0;

    var
    Total = 0;

    for

    Totally var = 0;

    var total = 0;

    for (var i = 1; i < = 5; i ++) {}

    var f = this.getField ("JDCRDropdown" + i);

    If {(f.valueAsString=="Y)"}

    Totally ++;

    total ++;

    } Else if (f.valueAsString == "N") {}

    total ++;

    }

    }

    If (total == 0) event.value = "n/a";

    else event.value = totally 'from' + total;

    The
    problem is that n/a is different from zero to zero. If I leave it as is, then the output by default s/o field. If I remove: if (total == 0) event.value = "n/a";  then it spits out 0 0 as the default value. What I need is for its default value to 0 of 0, UNLESS all of the 5 areas are N/A. So I need the output to be N/A.

    All 5 domains must have N/A selected for it to fill N/A.

    I tried a few different scripts without success.

    Thank you

    Add a variable to track the number of selections "N/a" and if it's 5 after the loop, set the value of the field "S/o".

  • Custom Script Format help

    I'm not too familiar with the scripts, but hope someone can provide advice or at least somewhere online that will show me how to do this.  Here's what I'm trying to do:

    I have I need of users to enter a specific digital format in a text field.  They have three choices of formats, but that one type is mandatory.  If I go into the options of arbitrary format, it would look like this: 99-9999999OOor 99-999-9999 999999-99999.  Now, is it possible to write a script so that it requires the user to enter the number/text in one of these three formats only?  I am able to implement an arbitrary mask and get one of them, but I need to provide options to the user.

    If there is little reading online where I can understand this myself well, let me know.  Otherwise, any input would be greatly appreciated.

    Thank you

    Dustin

    As mentioned, it is easier to use regular expressions. Here is a function that you can place in function at the level of the document and call it in the event of the key sequence:

    function checkFormat(s) {
    
        // A blank field is OK
        if (!s) return true;
    
        // Set up array of regular expressions
        var aRE = [
            /^\d{2}-\d{7}[a-zA-Z0-9]{2}$/,  // 99-9999999OO
            /^\d{3}-\d{2}-\d{4}$/,          // 99-99-9999
            /^\d{6}-\d{5}$/                 // 999999-99999
        ];
    
        // See if string matches any of the regular expressions in the array
        return AFExactMatch(aRE, s);
    
    }
    

    Here's what you would do in custom field Text Format script:

    // Custom Keystroke script for text field
    (function () {
    
        // When the user has committed the value...
        if (event.willCommit) {
    
            // ...check to see if what was entered is valid...
            var isValid = checkFormat(event.value);
    
            // ...and if not, alter the user and reject the value
            if (!isValid) {
                app.alert("Please enter a valid value.", 1);
                event.rc = false;
            }
        }
    
    })();
    
  • Script format

    I need a script that will automatically change the format of a text field if the user enters it in wrong. I can't use the Adobe format option by default because I had to put in a script of custom format for something in this area. If the user, for example, only 125 I need add a decimal number and change to 125.00. I know it's probably quite simple to do, but I'm pretty new to scripting and he couldn't understand. Thanks for your help!

    To what do you call, you can use the util.printf method:

    Event.Value = util.printf ("%.2f", event.value);

  • Trouble with the if else when used with event.value... Please help

    Please can someone shed some light on where I'm wrong.

    I have a pdf form that uses a drop-down menu for the SubBrand and a series of checkboxes for the location.

    the following code is placed as a calculation script custom field text of address and what im after is dynamically based on the site addressing and subbrand.

    However whats happening that does not change the address based on the location and not the subbrand.

    Someone please advice on this.

    Thank you

    If((this.getField("SubBrand").value == 'Passion' |)) ('Passion for men') & & (this.getField("Location").value == 'WW')) {}
    Event.value = "not Applicable";

    }

    else if ((this.getField("SubBrand").value == 'Passion' |)) ('Passion for men') & & (this.getField("Location").value == 'US')) {}

    Event.Value = "US02;

    }

    else if ((this.getField("SubBrand").value == 'Passion' |)) ('Passion for men') & & (this.getField("Location").value == 'WH')) {}

    Event.Value = "WH02";

    }

    else if ((this.getField("SubBrand").value == "Adventure" |)) 'Liquid ' | ("Silver") & & (this.getField("Location").value == 'WW')) {}

    Event.Value = "WW01";

    }

    else if ((this.getField("SubBrand").value == "Adventure" |)) 'Liquid ' | ("Silver") & & (this.getField("Location").value == 'US')) {}

    Event.Value = "US01."

    }

    else if ((this.getField("SubBrand").value == "Adventure" |)) 'Liquid ' | ("Silver") & & (this.getField("Location").value == 'WH')) {}

    Event.Value = "WH01;

    }

    on the otherEvent.Value = "";

    Is not a valid construction:

    If (this.getField("SubBrand").value == "Adventure" |) 'Liquid ' | "Silver")

    You need to use something like this:

    subBrand var = this.getField("SubBrand").value;

    If (subBrand == "Adventure" | subBrand == 'Liquid' | subBrand == "Silver")

  • Population Event.Value delay

    I have a few forms requiring barcodes for analysis.  In order to generate these bar codes, I create a text field using a 3sur9 font, set it read-only and the value of script:

    event.value = "*" + this.getField ("FIELDNAME") .value + "" * ";"

    Normally, it goes off without a hitch, but I'm having a problem with the way this FIELDNAME value where FIELDNAME is a scripted value.  For example, in one situation, FIELDNAME is a locked with a value by script text field:

    var A = this.getField("PART1").value;
    var B = this.getField("PART2").value;
    var C = this.getField("PART3").value;

    var strPart1 = String (A);
    var strPart2 = String (B);
    var strPart3 = A < 2? "0" + string (C): String (C); "
    var fullname = (strPart1 + strPart2 + strPart3);
    Event.Value = fullname;

    This is done because "PART1" is a mapped data field of 7 digits, "PART2" is a mapped data field of 2 digits and "Sect3" is a mapped 2-digit data field that often starts with a 0.  They must be concatenated to the bar code be correct, but there is no data for a fully concatenated value map.  The Field_Name field performs very well, but the barcode only outputs «*»  As soon as any other field in the form is filled manually, the bar code change to the appropriate "* FIELDNAME."

    I have no validation trigger anywhere in the form, but this seems to be an event validation that went wrong.

    Any ideas?

    Thanks in advance,

    A.

    I forgot to add, the problem is probably that the field calculation order is incorrect. To define it, go to the forms editing mode and

    then select "forms > edit > set field calculation order of fields.

  • I can set the number of events in the calendar to display in the Page Notifications?

    I have many calendar events every day (15-25), but only the following event appears in my display of notifications.   Is it possible for me to set the number I see?  As perhaps the next 3 or 5?  And then they are updated as events will expire?  iPhone 6 s

    No, it isn't. There are other calendar applications, for example schedule 5 of Readdle, that display more complete information, but it does not include the events 'expired' or has a Setup for the number of events displayed in the Notifications. I don't know either, but you can always check the App store. But to be honest, I doubt you will find one that handles what you are looking for in the notifications. The sight of Notifications is not really designed for the complete management of the content of the app.

  • I have two variables A and B. I mean "if (A or B &gt; 0) event.value = A + B.

    I have two variables A and B. I mean "if (A or B > 0) event.value = A + B.

    You must combine two compare different operations:

    If ((A > 0) |) (B>0)) {

    Event.Value = A + B;

    }

  • Event MultiLoadAction script - impossible to access the contents of the parameter "objLSItem".

    Hi all

    This is my first time I use the event MultiLoadAction script and I am struggling with access to the parameter "objLSItem" which should contain different details about the location, periods, etc. I need to have access to this information in order to develop and run custom scripts.

    Using the script VB TypeName() function, I learned that the parameter is a collection of objects of type "itmLoadSet". I checked the API guide and the internet to learn more about the structure of the parameter. Despite my research and several attempts, I was not able until now to access all the information stored in the "objLSItem" but I find myself constantly with errors (438: object does not support this property or method) in my script

    Can anyone tell more about the structure of the parameter 'objLSItem' and how do I access its contents in VB script? No reference to additional documentation on the issue is so very welcome.

    Thank you!

    Hello

    You can see the structure of the Workbench.

    Scripts > object browser > FDM objects > API additional objects > charger Multi objects > return objects

    Hope that helps

    akafdmee.blogspot.com

  • Event.value this.getField Edition

    I need to modify information that comes from there: event.value = this.getField("AccidentViolation").valueAsString;

    The problem is I can change the text, but as soon as I print or save, he comes back to the original text. I could use another code to copy this text that would allow me to change? He was selected in a drop-down list.

    Thanks for all the help.

    Nathan

    Try this:

    var f = getField ("AccidentViolation");

    If (event.source & event.source = f) {}

    F.valueAsString = Event.Value;

    }

    This will allow you to enter a different value, but it will reset to the value in the AccidentViolation field when it changes.

  • Have you also thought about a News Script Format

    After 20 years in the television news business we have managed another audio left right column layout used video column for the Assembly of the new live shows as well as post production documentary. Y at - it compensation for Adobe Story produce this format of script long proven as well?

    Thank you

    Hello

    We are planning to release a "AV Script" format shortly and would be very happy to get your entries on the same.

    Keep watching the forums for updates more about it.

    -L' team adobe story

  • chain number by "scan value" format string "%.3f" doesn'work

    I had a little problem.

    "To convert a string to a number, I use the function"scan value"with '%.3f' for the ' format string"connector. I would get a 3 digit number. But this doesn't work with the parameter "%.3f.

    Thank you.

    Please check the syntax of using LV Format specifier. There is a table that describes the purpose of each specifier. When you read in the description "when you use a function in shape", the specifier is applied to the number-> string, when you read "when you use a sweep feature", the specifier applies to the String-> number. The syntax of width element applies to both situations, the. Element of syntax accuracy does not work.

  • 10g BEEP format-number for negative values does not

    Hi all

    I tried the following methods to get the negative number locked up with symbols ().

    1 update the mask of BI Publisher properties of field format to

    "#, # 0.00;(#,##0.00).

    2 tried the Oracle formatting options

    <? format - number:A.INVOICE_AMOUNT; "PT999G999G999G999G999G999G999D00? >

    What gives me the result as below,

    Output value

    23.45 23.45 - print correctly

    -12.90 (12.90 - closing paren "")' does not print

    Please help me get the parenthesis when generating the PDF file.

    Thank you

    I had the question.

    This is the format that was used in your model

    ###,###,###,###,###,###,###,##0.00;(#)

    The first half before; does the mask so no problem.

    But after; which is for negative values and that is not the correct format.

    Please use this format on the properties of form field that gives you good number format

    #, ##0.00;(#,##0.00)

  • Set cell value digital format excel

    Hello everyone!

    I work with cell Set value.vi to send data to a workbook of labview. The only thing I can't do is change the format cell´s. For example, I send '-0.00049997' and it appears as "- 5, 00E - 4". " My goal is to show "- 4.9997E - 4 ', but I'm not able to change the width of the number or the digits of precision. Is it possible to change the format of the cell?

    Thank you in advance.

    Kind regards.

    You just set the NumberFormat for the cell, that you write. The format of the extract may be not exactly what you want, just adjust accordingly.

Maybe you are looking for

  • Qosmio X 70-B-10 t - output VGA supports only 1920 x 1080

    I'm defining two monitors HP Compaq LA2405wg on my Qosmio X 70-B-10 t, via HDMI and the other via VGA. Monitors run @ 1920 x 1200.Unfortunately, while the HDMI screen doing very well, the display connected via VGA goes up to 1920 x 1080. Is there a w

  • incoming connections

    I need help about creating an incoming connection. I want to access my LAN from home office, I put a computer on the local network as a server but I do not know how to set the client connection to the House. I have not found a useful article on the t

  • Broadcom Teaming 5709C emits in Win2008 R2

    Hi all We currently have a Dell R710 which is used for a SQL Server database. It's a future production system that will be widely used, so we want to allow the grouping on the 5709 4 network adapters that are present on the R710. But we have serious

  • Cancel a defragmentation with Powershell (Server 2008 R2)

    Hello world We defrag our servers with powershell all night (original is more complex). $AllVols = get-WmiObject-class Win32_Volume - filter "Drivetype = 3 '. foreach ($Vol in $AllVols) {$vol. Defrag ($false)} Now, we want to cancel defragmentation g

  • Don't port look for a printer in windows xp mode and virtual PC

    Have an older Calcomp plotter.  Used with Win xp.  The drivers are not compatible with windows 7 (64).  Upgrade to Win 7 Professional, downloaded xp mode and virtual PC.  All right.  Installed my plotter in xp Mode, but can't seem to find the plotter