Insert a NULL value when the field is empty

Oracle 11 g 2

Hi all

This is probably a very simple question.

Here's what's happening.

I have a table:
SQL> select * from mytable;

    MYCODE MYNAME          MYSAL
---------- ---------- ----------
      3456 Chris            8000
      9878 Bill
      6574 John             6500
And I am running the following query:
SQL> select 'insert into emp (empno, ename, sal) values (' ||mycode||', '||''''||myname||''''||', '||mysal||');'
from mytable;
gives me the following output:
insert into emp (empno, ename, sal) values (3456, 'Chris', 8000);
insert into emp (empno, ename, sal) values (9878, 'Bill', );
insert into emp (empno, ename, sal) values (6574, 'John', 6500);
If you notice, the second row has a sal as empty field. I want that he be null for what I can run this query to INSERT specific without having to manually enter the word "NULL" inside

I think I need some kind of clause if-then here.

If sal is NULL
then the value NULL?

Hello

JrOraDBA wrote:
...
If you notice, the second row has a sal as empty field. I want that he be null for what I can run this query to INSERT specific without having to manually enter the word "NULL" inside

I think I need some kind of clause if-then here.

Exactly!

This condition IF-THEN-ELSE happening so often that they have designed a function for this.
Instead of my_sal, use this expression:

NVL ( TO_CHAR (mysal)
    , 'NULL'
    )

It is:

select 'insert into emp (empno, ename, sal) values ('      || mycode
                                                      ||    ', ''' || myname || ''''
                             ||       ', '      || NVL ( TO_CHAR (mysal)
                                                     , 'NULL'
                                        )
                             ||   ');'
from   mytable

Tags: Database

Similar Questions

  • Show LOV only when the field is empty

    Hi all
    My surroundings:
    Oracle 10g on Windows
    Forms [32 bit] Version 9.0.4.1.0 (Production)
    Oracle Database 10 g Enterprise Edition Release 10.2.0.5.0 - 64 bit Production
    With partitioning, OLAP, Data Mining and Real Application Testing options
    Oracle Toolkit Version 9.0.4.1.0 (Production)
    PL/SQL Version 9.0.1.5.1 (Production)

    My problem:
    I have a field in a block, which is text_item and is linked to an element of LOV. I want the LOV appears automatically, whenever I tab in there, only when the element is EMPTY (for example when I try to insert in the block). When, upon request, it should show only the value in the field, and user can choose to activate the LOV, by pressing F9, if she wants to. It now displays automatically each time text agenda is a debate (works very well when the user is inserted, but annoying when she questioned the shape and trying to tab thru.) Every time she focuses on the field, LOV is popping up!)

    The current setting for the property on the element of text field: Type: text element
    The list of values: MY_LOV_NAME
    Validation of list: Yes

    Properties on MY_LOV_NAME
    Auto display: Yes

    Any suggestions? Or trigger level I can use, and if so, what build_in can use?
    New forms and will greatly appreciate advice from pros!

    Thank you
    Libran_girl

    It's very simple,

    IN once - new - item - Instance

    DECLARE
    V_LOV BOOLEAN;
    BEGIN
    IF: NOM_ELEMENT IS NULL
    THEN
    V_LOV = SHOW_LOV (LOV_NAME);
    END IF;
    END;

    Try it, you will get your result, if it doesn't work, try: block_name.item_name

    Abbas

  • Calculated hidden field when the field is empty

    It is actually similar to a discussion a few months ago. Our forms are designed to be completed online, printed and sent by electronic mail, by fax or snail - mail. Many times the customer will simply print the form and complete it by hand. When I create forms with calculations, the ' $' or '0.00' appear; This makes it difficult for a person filling out the form by hand to work around these symbols/numbers. A few months ago I had a similar situation involving the percentages and the gurus on this forum (thanks, gurus!) has helped me with the following code and it worked perfectly to hide the fields calculated, unless something has been entered in the fields to calculate.

    A field with a format of 'None' user custom validation script:

    if(Event.Value == 0) {}
    Event.Value = ""; Set null field;
    AFNumber_Format (0, 0, 0, "", "", true); Set number format 0 decimals, not currency.
    } else {}
    Event.Value = event.value; keep the value;
    AFPercent_Format (2, 0, 0); Set the percentage, 2 decimal format.
    }

    This time, the problem involves single numbers (not percent, no change). I used the same logic and fields actually hide/as I want, but the numbers should be formatted with a comma between thousands and decimal with two digits after. I can't understand this! Can someone please offer some advice? Thanks in advance for your help.

    Make sure you use the correct quotation marks. Use quotation marks or single quotation marks, and not 4 single quotes.

    if(Event.Value == 0) {}

    Event.value = "; Set the field null (2 single quotes).

    Supress Zero

  • Null value in the Datetime field

    I have a form that inserts data, but the date fields have a value default (01/01/1900 12:00:00 AM) even if I do not insert a value for this field. How to enter a NULL value in the fields of datatime value MSSQL.instead default (01/01/1900 12:00:00 AM) that gets inserted?

    Here's my insert statement.

    < type CFLOCK = "exclusive" timeout = "10" >
    < name CFQUERY = "InsertWorkflow."
    DataSource = "" #request.app.DSN # ""
    username = "" #request.app.bsruser # ""
    Password = "#request.app.bsrPassword #" >
    INSERT INTO #request.app.DB # .v_NAR_WorkFlowLog
    ([SatApp_ID]
    [User_ReqApproval_Logon]
    [User_ReqApproval_Date]
    [Admin_ReqProcessed_Logon]
    [Admin_ReqProcessed]
    [Prelim_Approval_Level]
    [Prelim_Approval_Date]
    [Prelim_Approval_Explain]
    [Req_Withdrawn_Date]
    [Req_Withdrawn_Explain]
    [Req_Denied_Date]
    [Req_Denied_Explain]
    [User_Req_FinalAppl_Date]
    [Admin_FinalAppl_Date]
    [DateLastUpdated]
    [UpdatedBy])
    VALUES
    (#SatApp_ID #)
    , "#User_ReqApproval_Logon #
    , "#User_ReqApproval_Date #
    , "#Admin_ReqProcessed_Logon #
    , "#Admin_ReqProcessed #
    , "#Prelim_Approval_Level #
    , "#Prelim_Approval_Date #
    , "#Prelim_Approval_Explain #
    , "#Req_Withdrawn_Date #
    , "#Req_Withdrawn_Explain #
    , "#Req_Denied_Date #
    , "#Req_Denied_Explain #
    , "#User_Req_FinalAppl_Date #
    , "#Admin_FinalAppl_Date #
    , "#DateLastUpdated #
    ("#UpdatedBy #")
    < / CFQUERY >
    < / CFLOCK >

    Thank you

    Shearak

    CFQueryParam would work? For example:

    So, using your example, this would be your insert:


       
    DataSource = "" #request.app.DSN # ""
    username = "" #request.app.bsruser # ""
    Password = "" #request.app.bsrPassword # ">"
    INSERT INTO #request.app.DB # .v_NAR_WorkFlowLog
    ([SatApp_ID]
    [User_ReqApproval_Logon]
    [User_ReqApproval_Date]

    [Admin_ReqProcessed_Logon]
    [Admin_ReqProcessed]
    [Prelim_Approval_Level]
    [Prelim_Approval_Date]
    [Prelim_Approval_Explain]
    [Req_Withdrawn_Date]
    [Req_Withdrawn_Explain]
    [Req_Denied_Date]
    [Req_Denied_Explain]
    [User_Req_FinalAppl_Date]
    [Admin_FinalAppl_Date]
    [DateLastUpdated]
    [UpdatedBy])
    VALUES
    (#SatApp_ID #)
    , "#User_ReqApproval_Logon #
    , "#User_ReqApproval_Date #
    , "#Admin_ReqProcessed_Logon #
    , "#Admin_ReqProcessed #
    , "#Prelim_Approval_Level #
    , "#Prelim_Approval_Date #
    , "#Prelim_Approval_Explain #
    , "#Req_Withdrawn_Date #
    , "#Req_Withdrawn_Explain #
    , "#Req_Denied_Date #
    , "#Req_Denied_Explain #
    , "#User_Req_FinalAppl_Date #
    , "#Admin_FinalAppl_Date #
    (, ' #UpdatedBy # ')
       

  • Case when the field IS NULL then... end

    Hello world

    (a) If a field is null, display a message.

    (b) the field shows beak null. application for admin to make outer joins between the tables.

    (c) I have 9 rows, 3 have NULL values,
    So, I want to show a literal message on 3 rows.

    problem is that the message shows on all the 9 lines.


    now:
    ====
    I could have adopted an approach very unorthodox at this request, please bear with me.
    I work for a college and am interested in students who did not encourage the "" in the last six months
    for this semester, beak. they repeat the year.

    200830 M1 generally promote to 200920 M2 (m1 attribute replaced by m2)

    M1 - 1 year 200830 = winter
    M2 - 2nd year 200920 = fall (200910 is special and not interested by this semester for this request)


    I want to run a query to search for the students who did not encourage.

    hand the sql would be:

    SELECT st1.id
    st1.name
    sa1.academic_period
    sa1.student_attribute
    sa2.academic_period
    sa2.student_attribute
    Student st1
    INNER JOIN student_attribute sa1
    ON st1.person_uid = sa1.person_uid
    AND sa1.academic_period = '200830'
    AND sa1.student_attribute = 'M1 '.
    LEFT JOIN student_attribute sa2
    ON st1.person_uid = sa2.person_uid
    AND sa2.academic_period = '200920'
    AND sa2.student_attribute = 'M2 '.
    where st1.academic_period = '200830'
    and sa2.student_attribute is null
    ORDER BY st1.name;


    ===========

    taking the hardcoded values and putting a LEFT JOIN simplified in a display/custom folder
    and then by creating the conditions in discoverer, essentially behaved as an EQUI-join and do not show the
    null lines

    =============

    I compare a "slice" of data "another" data 200920/m2 200830/m1

    so I begged the admin as an experiment to "clone" the desired table as 2 views and external to join them
    Discover the left join to student attribute #1 to
    attribute of student views #2


    and using the technique to deceive the discoverer of a LEFT JOIN in: student_attribute is null or student_attribute is null

    I got what I wanted - pupils with NULL values in attribut2, beak. they did not encourage

    ==============

    so now I wanted to create a new discoverer in copying the above query query and adding new 'logic ':

    In this new queyr am interested if the student extensible query determined #1
    have been coded by the staff in order to take into account that they repeat:
    M1 200830 as:
    M1 200920 (their bump up current semester with the same code attribute)

    so I thought... hmmmmm... I also have the ordinary table: attribute of the student
    now watch a 3rd data slice: 200920 m1


    Discover the left join to student attribute #1 to
    attribute of student views #2

    left to join University
    attribute of student views #1

    I access the beak ordinary table this pre-established join :

    University to join
    student table attribute

    ====================
    so my 2nd query uses:
    -Discover the condition attribute #1 student: 200830/m1
    -Discover the condition attribute #2 students: 200920/m2
    -University studies
    -condition of table student attribute: 200920 / * m1 *.


    and to maintain the table: attribute of student for M1 200920
    to see if records created the current semester for Extensible students staff


    This query has worked, got the 9 lines, of which 3 had to be coded to 200920/m1
    For lines 3 nulls, want to create a calc that would show this literal:

    "needs 200920 m1 folder.

    the problem is the literal is printing even on rows that have a value in the fields from the table, it's the calc:


    BOX WHEN (period DMC_Student_Att2.Academic IS NULL) THEN

    "NEEDS" | "'-> ' |: Parm_AcademicPeriod_Current |" " ' || : Parm_StudentAttribute_Prev

    END


    Any advice that might work with this unorthodox approach would be greatly appreciated,
    Advice to the other approaches would be also appreciated, tx, sandra

    Hi, Sandra
    When you work with outer joins, with that I conclude with a double whammy an OR statement allows me to make some incredible manipulations.

    For example, if you have a folder that the master joined the detail folder B with an outer join on B you get records from one if they exist in B or no - no?

    It doesn't have to be the case, you're just limit your way of thinking. It must get off the beaten and tell ourselves, if I could force discoverer to create a subquery with the NULL filter outside, I could find these B that don't have any corresponding entry in B, or I could find who had only the entries in the two.

    Let's say there's a STUDENTID b, using a normal like condition: B.STUDENTID IS NULL will not work because of the outer join. But if you create a Boolean condition, like this:

    B.STUDENTID IS NULL or B.STUDENTID IS NULL you will see amazing results.

    This tip can help.

    In which your question, taking the knowledge above, I was wondering what would happen if you did:

    BOX WHEN (period DMC_Student_Att2.Academic IS NULL) OR (period DMC_Student_Att2.Academic IS NULL) THEN

    "NEEDS" | "'--> ' |: Parm_AcademicPeriod_Current |" " ' || : Parm_StudentAttribute_Prev

    I am not sure it will work. If it isn't then you need create 2 worksheets, one containing the students who made the promotion and the other for those who do not. You need the conditions to make this work, one like this:

    * (Period of DMC_Student_Att2.Academic IS NOT NULL) OR (DMC_Student_Att2.Academic period IS NOT NULL) *.

    and other like this: * (DMC_Student_Att2.Academic period IS NULL) OR (DMC_Student_Att2.Academic period IS NULL) *.

    Best wishes
    Michael

  • How to print line empty on the model of BEEP when the field has no value?

    I have a BEEP pattern like below and all these CHILDREN, NAME, GRAND_CHILDREN, are fields arranaged in the model as a line. REPS can enter the values in each of these areas for maximum 3 lines. The first 2 rows have values and the last is empty.

    CHILDREN: NAME: GRAND_CHILDREN: NAME:
    Son daughter of John Smith
    Daughter Laura son Kevin

    In the third row, because the fields have no value, the report print empty lines, but I want to remove this blank line and display only the rows (first 2 rows) that have values for the fields.

    Does anyone know how to get around this problem? Please help me solve this problem.

    Thanks in advance,
    RV

    Just having a condition in 3rd row, where DependentDD3 is printed.

    -3rd line 1st column
    last column - 3rd row

    This is true for nullity of DependentDD3. If you want to check for all columns and hide, use condition as

  • How can we access the value of the field in a line removed in the buffer of the component?

    In the PeopleSoft component buffer when it removes a parent row children lines are also deleted, therefore, not possible to access the value of the field of these lines.

    Example: If we have RECORD1 at level 1 and RECORD2 (which contains the INCIDENT_NBR field) at level 2.

    If a row is deleted at level 1, level 2 lines are also deleted, but before delete, I need access to the value of INCIDENT_NBR and make sure no line (s) not many for this value in a third record record RECORD3.

    If any line exist in the RECORD3 record an error message should appear in the case otherwise the delete process can go.

    I put the peoplecode in RECORD2. INCIDENT_NBR. SavePreChange (at the record level) because this control must be carried out in all cases for all the component where my RECORD2 record is used.

    When I display the value of the field I always get a null (00000000 digital).

    It is possible that in PL/SQL within a trigger, but unfortunately in this case, I can not catch the error produced by RAISE_APPLICATION_ERROR (-20000, 'Suppression of an incident not allowed when there are dagnostics'); in Peoplecode.

    Does anyone know if there is a way to get the values of the fields in the deleted lines?

    Thank you

    A rowset object has two properties

    ActiveRowCount

    All lines of lines in an exclusive set of deleted rows

    Number of lines

    All lines of a set of lines included the deleted rows.

    So I would say, to loop through all lines and check for deleted rows and make any desired logic, something like:

    For & i = 1 to & rs. Number of lines

    & line = & rs. GetRow (&i);)

    If & row. IsDeleted then

    & rec = & rank. GetRecord (1);

    & fld = & rec. GetField (FIELD. YOURFIELD);

    / logical necessary * /.

    End - If;

    -End;

  • resolveNode returns a null value when a variable is used.

    LiveCycle Designer ES2, latest version

    Hello

    The following Javascript code, in the click event of a button, returns a null value for the variable opaque. When I manually enter the expected value the script works perfectly.

    I tried various modifications of the resolveNode line such as var opaque = xfa.resolveNode (qPage); , but without success.

    Also studied all the documents reference Adobe that I could find on the scripts and resolveNode. Any suggestions?

    var qPage = (Cell12.rawValue + "AnchorField");
    App.Alert (qPage);
    Opaque var = xfa.resolveNode ("' $... qPage '");
    App.Alert (opaque);
    var nPage = xfa.layout.absPage (opaque);
    App.Alert (nPage);
    xfa.host.currentPage = nPage;

    Thank you

    Ron

    I tried your sample and it seems to work very well... but I'm not sure 100% that you are trying to do... .going to your initial question on the passage of a variable in the resolveNode resolveNode expects a string, so you must use the following syntax to create the string:

    xfa.resolveNode ("$.." + qPage)

    Note that the variable is outside the quotes as such the string $... is added to the content of qPage. This wil work if qPage is a string as well.

    In your example you have defined qPage as an XFA object so that the syntax above will not work. If you intend to use the same way, you would use qPage.name so that the name of the field will be returned (this is a string) and it will be added to your expression of $ to make the $... ProductAnchorField

    Thus, the expression would be:

    xfa.resolveNode ("$.." + qPage.name)

    Make sense?

    Paul

  • NPE for rows with null values in the table of the adv

    I created the table adv, 2 columns, equipped with two text fields. Initially the col2 is empty,
    say that the structure is as follows:
                  col1          col2
    Hdr         Question    Answer
    row1       abc           zxc
    row2       pdd           null (user doesnt enter anything)
    row3       zxc            lkj
    
    APPLYBUTTON
    When the user clicks on apply button I want to update these values in the table.

    I don't know how to do that, but that's what I'm trying to do. Please guide me the right way if its wrong.

    in LICS, I took the APPLYBUTTON action, got all lines of the object corresponding to the view, consulted with everyrow and I'm checking if there are values in the fields in the table, if the value zero, are simply print null. (we would not update on this line). . I could get o the part update, due to null pointer exception
    I get on the row line null pointer exception [1].getAttribute("Answer") for row2, it prints the value of row1 however.

    Here is the code I wrote:
    Set of rows from the rowset = (RowSet) vo.getRowSet ();
    Rank rank [] = vo.getAllRowsInRange ();
    System.out.println ("row.length" + row.length);
    for (int i = 0; i < row.length; i ++) {}
    String question = row.getAttribute("Question").toString ();
    String response = row [i].getAttribute("Answer").toString ();
    If (question! = null & &!("".)) Equals (question. Trim()))
    {
    System.out.println ("Question line" + i + "-" + question);
    }
    on the other
    {
    System.out.println ("Question line" + i + "is null");
    }

    If (response! = null & &!("".)) Equals (Answer.Trim ()))
    {
    System.out.println ("Response line" + i + "-" + response);
    }
    on the other
    {
    System.out.println ("Response line" + i + "is null");
    }

    Why the NPE survey code, I'm checking for null value and you want to print the value null in the logfile... I can not to getAttribute() on the null field, why can not just give me null in the variable I'm assigning to?

    You can guide me what approach to take, if it is not correct.
    I must examine DataDictionary and collect data there?
    Thanks in advance.

    Hello

    handle the exception of null on these two statements like this pointer

    String question = "";
    String response = "";

    Try
    {
    question = row.getAttribute("Question").toString ();
    }
    catch (NullPointerException e)
    {
    question = "";
    }

    Try
    {
    answer = row.getAttribute("Answer").toString ();
    }
    catch (NullPointerException e)
    {
    response = "";
    }

    Si ( !("". Equals (question. Trim()))
    {
    System.out.println ("Question line" + i + "-" + question);
    }
    on the other
    {
    System.out.println ("Question line" + i + "is null");
    }

    Si ( !("". Equals (Answer.Trim ()))
    {
    System.out.println ("Response line" + i + "-" + response);
    }
    on the other
    {
    System.out.println ("Response line" + i + "is null");
    }

    Thank you
    Gerard

  • Is it possible to display the dynamic value in the ToolTip? I tried: this.assist.toolTip.value = this.rawValue; for a text field 'property MouseEnter', but it does not display the current raw value. It displays a previous raw value of the field... Guilty

    Is it possible to display the dynamic value in the ToolTip?

    I tried:

    this.assist.toolTip.value = this.rawValue; for a text field on 'ownership' MouseEnter

    but it does not display the current raw value. It displays a previous raw value of the field...

    I wrote 'YYYY', but is not displaying on the first mouseEnter event

    Capture_1.JPG

    When I show event mouseEnter for the 2nd time it gives good value.

    Capture_2.JPG

    Now, I changed the "BBBB" value but the first mouseEnter event it displays the value previous i.e. "YYYY."

    Capture_3.JPG

    I found the solution. I wrote the script ("this.assist.toolTip.value = this.rawValue ;") on 'property MouseEnter' but the need to write the script to the "Output" of the field event. ")

    Thank you.

  • How to find duplicates of a field value? For example - in a field, I have values like {123,345,346,123}, now I want to remove the duplicate value in the field so that my output looks like {123,345,346}

    How to find duplicates of a field value? For example - in a field, I have values like {123,345,346,123}, now I want to remove the duplicate value in the field so that my output looks like {123,345,346}

    If it's an array you want to deduplicate then here is a script [for use in the Script Processor] I prepared earlier:

    var result = new Array();

    var added = new Object();

    If (input1 [0]! = null)

    {

    for (var i = 0; i)< input1[0].length;="">

    {

    var point = input1 [0] [i];

    If (! added [item])

    {

    added [item] = 1;

    result [result. Length] = item;

    }

    }

    }

    Output 1 = result;

    Kind regards

    Nick

  • The data specified in the request is invalid. The value of the field id package is not a MultipleLiteral, but the field is defined as MultiValued

    We have a property in a component software which is an array. the value is [""]

    In the blueprint I am sitting a value property ['vim', 'emacs'] defalult

    When I ask this plan and change the values of foo, bar, I get this error

    The data specified in the request is invalid. The value of the field id package is not a MultipleLiteral, but the field is defined as MultiValued

    someone knows why this happens?

    I'm runnign vra7.0.1

    Strangely, it works if

    Overridable is set to NO

  • How to find null values in the table

    Hi experts,

    my version is oracledb10g:

    I am doubted simple.

    for example:

    create table ex1 (e varchar2 (20));

    Insert ex1 (null).

    insert into ex1 (e)

    number of will be: 2

    I can easily find the value "e".

    so my question is:

    How can I find null values in the table and I want to remove the null values from the table.

    ADF 7 wrote:
    Hi experts,

    my version is oracledb10g:

    I am doubted simple.

    for example:

    create table ex1 (e varchar2 (20));

    Insert ex1 (null).

    insert into ex1 (e)

    number of will be: 2

    It depends on what you expect. If you issue count (*) you ask Oracle "how many lines there. If you issue a County () you ask Oracle 'how non null values for are there. "

    ADF 7 wrote:

    I can easily find the value "e".

    so my question is:

    How can I find null values in the table and I want to remove the null values from the table.

    delete from 
    where  is null;
    

    Ideally you would simply place a NOT NULL constraint on the column in question, thus prohibiting NULL values into the system (assuming that your business needs, it is that the column MUST always have a value).

  • How can I get rid of zero in a calculated field when the form is empty?

    I made a form that prompts the user to enter data for specific years.  At the top of the form, the user places in the current year, i.e. 2000.  Column copy this year here, the second column adds five years and the third column adds 10 years.  I managed to create a simple script for each of these columns (so that when 2000 came; columns a, b, and c appear as 2000, 2005 and 2010) but when the form is empty a zero appears in the first cell, a 5 appears in the second cell and a 10 appears in the third cell.  I want the completely empty form so as to not confuse the person when they begin to enter data.  How can I write a custom script to eliminate the numbers in calculated fields?

    I would use a script for calculating customized for each of these fields. Something like:

    Calculation for reference year script

    (function () {}

    Get the value of the WCPYear field

    var v = getField("WPCYear").valueAsString;

    Set the value of this field. The value empty if WCPYear is empty

    Event.Value = v? v : "";

    })();

    Calculation script for field goal 5 years

    (function () {}

    Get the value of the WCPYear field

    var v = getField("WPCYear").valueAsString;

    Set the value of this field. The value empty if WCPYear is empty

    Event.Value = v? +v + 5 : "";

    })();

    Calculation script for the 10-year target field

    (function () {}

    Get the value of the WCPYear field

    var v = getField("WPCYear").valueAsString;

    Set the value of this field. The value empty if WCPYear is empty

    Event.Value = v? + v + 10 : « » ;

    })();

  • Change the number of decimal places according to the value of the field

    Hello world

    I'm doing a form using Adobe Acrobat.

    I want a field that usually has only 2 decimal places, to have 4 decimal positions ONLY when necessary.

    Example: If the value of the field is 3.53 that's fine, but if the value is 3,5346 I want to show him this.

    I played around field properties and I realized that I need to use a custom format script. I don't know where to start, however. Can you point me in the right direction?

    Thank you in advance.

    I just threw together quickly and did not test, take is as a general guide. It is intended to be placed in a JavaScript to the document level and called from custom Format script of the field. You can not put it simply everything as the script to Format because of the way that Acrobat behaves when you do.

    The point of the script is to calculate the number to use as the first parameter to the AFNumberFormant function, which is that Acrobat uses when configuring a digital format. I couldn't think of a clever name for the function, so I leave it to you:

    function fmt1() {
    
        // Set the minimum number of digits to the right of the decimal
        var min = 2;
    
        // Get the field value, as a string
        var val = event.value;
    
        // Round to the nearest 10-thousand of a cent
        var rn = util.printf("%.4f", val);
    
        // Replace any trailing zeroes with nothing
        rn = rn.replace(/[0]+$/, "");
    
        // Get the number of characters after the decimal
        var num = rn.split(".")[1].length;
    
        // Set to the minimum if appropriate
        if (num < 2) num = 2;
    
        // Use built-in formatting function
        AFNumber_Format(num, 2, 0, 0, "\u20ac", true);
    
    }
    

    Call it like that in the case of the field Format:

    fmt1();
    

    If this isn't a calculated field, but the one who interacts with a user, you'll want to add a function with the swing, something like:

    function keystroke1() {
    
        AFNumber_Keystroke(2, 2, 0, 0, "\u20ac", true);
    
    }
    

Maybe you are looking for

  • 810 Acer a1 storage

    I use really low on storage space and do not want to get rid of the apps I have. However, there are applications that already settled that I don't use and I was wondering if I could get rid of them and how.

  • Where Resistry of OneCare Cleaner?

    I was using OneCare Safety Scanner to the cleaner, I Security Essentials which works fine but I noticed on the site of One Care that it's just an analysis of the AV now. How can I get the registry cleaner, it worked VERY well?

  • SSL/tls over TCP using tcplistner socket or a tcpclient

    I am trying to use ssl/tls, TCP, but in my code, the socket is used not a tcpclient or tcplistner. I searched on the net at least 200 links but I have not everything related that. I want to use less coding and fact ssl or tsll during the tcp socket c

  • 10 installing Canon printer error code

    Hello I have a problem whit my pc, I can not install (or more) my printer with the USB port, it does not recognize the printer. When I click to solve the problem it says 'teredo tunneling microsoft code adapter 10 '. He cannot bring himself Red Cross

  • computer HP pavilion dv4 laptop has this thin line at the bottom of the screen, need help?

    Hello, recently my HP Pavilion dv4 has been glitching, theres this thin line at the bottom which is a whitesh and flashes very quickly. At first I thought it was because of overheating because of the summer, but I'm not so sure most since the weather