Not able to print the decimal values in a table

Hi all

I created an application. Here, I have a table with three columns Col1 and col2 are numbers and col3 is the diffrence between col1, col2.

I use AJAX and JavaScript to calculate the difference in a dynamic way.

I am able to print the difference as for example:-1, 2, 1.5-1.5. but not 0.8, 0.8, 0.1 etc...

If col1 col2 = 1.2 - capable of printing

If col1 to col2 = 0.2 - error, unexpected token

error_07012016.PNG

-Code AJAX:

Declare  
  p_curr  number;  
  p_prev    number;  
  p_diff number;  
Begin  
  p_prev    := to_number(apex_application.g_x01);  
  p_curr    := to_number(apex_application.g_x02);  
  
   
  SELECT to_number(p_curr - p_prev) into p_diff  
  from dual;  
  
  -- return calculated value
  sys.htp.p(p_diff);  
End;

-JavaScript: running the loading of the page

function f_calulate_duration(pThis) {  

  var row_id     = pThis.id.substr(4);  
  var s          = $('#f18_'+row_id).val().replace(/[^\d.-]/g, ''); 
  var curr       = $(pThis).val().replace(/[^\d.-]/g, ''); 

if(!s){
  var s= 0;
  var prev = s;}
else{
  var prev = s;}

apex.server.process 
( "CALC_DIFF", { x01: prev, x02: curr }, 
{ success: function( pData ) { 
$('#f23_'+row_id).val(pData);}}
);  
}  

Please suggest the solution to this.

Oracle Apex Version: 4.2.

Thank you

Dev

Hello

I don't get the point to use the expensive AJAX call to the database, instead you can have the same functionality with JavaScript code below.

function f_calulate_duration(pThis) {
  var row_id     = pThis.id.substr(4);
  var s          = $('#f18_'+row_id).val().replace(/[^\d.-]/g, '');
  var curr       = $(pThis).val().replace(/[^\d.-]/g, '');   

if(!s){
  var s= 0;
  var prev = s;}
else{
  var prev = s;}

var diff = 0;
diff = curr - prev;
var n = diff.toFixed(2);
alert(n);
$('#f23_'+row_id).val(n);  

//-- Remove this code
/*apex.server.process
( "CALC_DIFF", { x01: prev, x02: curr },
{ success: function( pData ) {
$('#f23_'+row_id).val(pData);}}
);*/

}    

Thank you

D

Tags: Database

Similar Questions

  • not able to print the value of the url (aaa #bbb)

    Hello

    I am not able to print the < cfoutput > #url.xyz # < / cfoutput >

    Here, the url.xyz in the url value is aaa #bbb

    It is printing only aaa

    You should have url-encoded query from the beginning chain. Given that you don't have, Coldfusion ignored everything in the query string that comes after the character #. To fix this, replace the character # % 23. . In other words, .

    Another rule is that we should avoid the occurrence of the character # in a string. Thus, the correct value to cfoutput is "aaa ##bbb". To get and display code that is



    #url_xyz #.

  • Not able to print the PDF with firefox 29,0 Preview pdf plugin. Why?

    Not able to print the PDF with firefox 29,0 Preview pdf plugin. Why?

    The 29.0.1 firefox solved my problem!

    Please check: Firefox-> Preferences-> tab-> applications (option) Portable document Format (PDF)-> Preview in firefox

    Good luck!

  • Not able to print the message after redirection to another page of pag current

    Hi Experts,

    I'll call you a procedure (who accepts 4 parameters IN) page of the OAF by pressing a button.

    My page contains: 4 elements of text Message and the other present button.

    I enter values in the 4 message text of introduction of the elements; After clicking on the button submit, he calls with success the procedure.*After by clicking on the button submit, after the call to procedure, I would like to pass on the same page with the values parameter zero and display confirmation message *.

    But I am not able to make the parameter null values in the page.


    I have the code in my page controller below.

    REQUEST FORM PROCESS:

    OAApplicationModule oa = pageContext.getApplicationModule (webBean);


    {if (PageContext.GetParameter ("Submit")! = null)}
    CallableStatement call_proc = null;
    try {}
    call_proc = OA.getOADBTransaction () .createCallableStatement ("start oaf_test_tbl_insert_proc(:1,:2,:3,:4,:5); end; ", 5) ;
    call_proc. SetString (1, PageContext.GetParameter ("empno"));
    call_proc. SetString (2, PageContext.GetParameter ("Ename"));
    call_proc. SetString (3, PageContext.GetParameter ('Work'));
    call_proc. SetString (4, PageContext.GetParameter ("Salary"));
    call_proc.registerOutParameter(5,types.varchar);
    call_proc. Execute();
    oa.getOADBTransaction () .commit ();

    String message = call_proc.getString (5); out parameter (5) will return a message


    OAException message = new OAException (message, OAException.CONFIRMATION);
    pageContext.putDialogMessage (message);

    pageContext.forwardImmediately ("OA.jsp?page=/practice_test_prc1/oracle/apps/mfg/simplepg/webui/oaf_test_tbl_calling_proc"
    null
    OAWebBeanConstants.KEEP_MENU_CONTEXT
    null
    null
    true
    (null);

    } catch (SQLException e) {}
    call_proc. Close();
    }

    }


    Kindly help me, how to print the confirmation message and send to the same page by making the param to null values.

    Hello

    On the successful return of the procedure, you must set a session Variable * (pageContext.putSessionValue ("WFFullListPage") *.)

    Then call it.

    pageContext.forwardImmediately ("OA.jsp?page=/practice_test_prc1/oracle/apps/mfg/simplepg/webui/oaf_test_tbl_calling_proc"
    null
    OAWebBeanConstants.KEEP_MENU_CONTEXT
    null
    null
    true
    (null);

    Next, you need to check this condition on the PR of the CO and show the message as required.

    Extract the same value to the controller, as * (pageContext.getSessionValue ("WFFullListPage") *)

    Kind regards
    GYAN

  • Insert using TO_NUMBER does not seem to accept the decimal value

    Oracle 10g

    I'm trying to insert a decimal value in a table from another table oracle oracle. The column of the source table is a data type
        "PLOTSIZE10_30CM"    VARCHAR2(4 BYTE),
        "PLOTSIZE30_50CM"    VARCHAR2(4 BYTE),
        "PLOTSIZE50CM"       VARCHAR2(3 BYTE),
    The destination table contains the following:
        "PLOT_SIZE_10_30CM" NUMBER(7,0),
        "PLOT_SIZE_30_50CM" NUMBER(7,0),
        "PLOT_SIZE_50CM"    NUMBER(7,0),
    When I run the insert statement as the following decimal values are not inserted into the destination table.
    SQL> SELECT DISTINCT PLOTSIZE50CM FROM IMPORT_DATA WHERE STAND_ID = 23;
    
    PLO
    ---
    0.2
    
    SQL>
    SQL> INSERT INTO
      2  psp_plot_measurements
      3  ( species_major
      4  , plot_location_id
      5  , codominant_height
      6  , regen_density_primary_code
      7  , regen_density_secondary_code
      8  , PLOT_SIZE_10_30CM
      9  , PLOT_SIZE_30_50CM
     10  , PLOT_SIZE_50CM
     11  )
     12  SELECT DISTINCT species_major
     13       , '2'
     14       , height_codom
     15       , regen_prim
     16       , regen_sec
     17       , TO_NUMBER(plotsize10_30cm)
     18       , TO_NUMBER(plotsize30_50cm)
     19       , TO_NUMBER(plotsize50cm)
     20    FROM import_data
     21    WHERE stand_id = 23;
    
    1 row created.
    
    SQL>
    SQL> SELECT PLOT_SIZE_50CM FROM PSP_PLOT_MEASUREMENTS;
    
    PLOT_SIZE_50CM
    --------------
                 0
    See you soon
    Ben

    Hi Ben,

    If the destination table have the column as a Number (7.0) and then how you can store a decimal value.

    The destination table contains the following:

    "PLOT_SIZE_10_30CM" NUMBER(7,0),
    "PLOT_SIZE_30_50CM" NUMBER(7,0),
    "PLOT_SIZE_50CM"    NUMBER(7,0),
    

    Look at sample scenario-

    SQL> CREATE TABLE TEST1(COL NUMBER(7,0));
    
    Table created.
    
    SQL> CREATE TABLE TEST2(COL NUMBER(7,1));
    
    Table created.
    
    SQL> INSERT INTO TEST1(COL) VALUES(1.234);
    
    1 row created.
    
    SQL> INSERT INTO TEST2(COL) VALUES(1.234);
    
    1 row created.
    
    SQL> INSERT INTO TEST1(COL) VALUES(0.234);
    
    1 row created.
    
    SQL> INSERT INTO TEST2(COL) VALUES(0.234);
    
    1 row created.
    
    SQL> SELECT * FROM TEST1;
    
           COL
    ----------
             1
             0
    
    SQL> SELECT * FROM TEST2;
    
           COL
    ----------
           1.2
            .2
    
    SQL>
    

    If you want to store the decimal value, you must modify the destination table.

  • Not able to print the value of the variable

    I wrote the code below

    create or REPLACE PROCEDURE ARMSTRONG_NUMBER_a
    as
    
    
    arm_num number :=371;
    num_len number:=0;
    a number:=0;
    b number:=0;
    c number;
    BEGIN
    num_len := length(arm_num);
    for i in 1..num_len
    loop
    DBMS_OUTPUT.put_line('VALUE of i ' || i );
    b:= substr(a,i,1) ;
    DBMS_OUTPUT.put_line('VALUE OF b ' || b );
    end loop;
    end;
    
    

    Hello

    Rahul_India wrote:

    I wrote the code below

    1. create or REPLACE PROCEDURE ARMSTRONG_NUMBER_a
    2. as
    3. number of arm_num: = 371;
    4. num_len number: = 0;
    5. a number: = 0;
    6. b number: = 0;
    7. c number;
    8. BEGIN
    9. num_len: = length (arm_num);
    10. because me in 1.num_len
    11. loop
    12. Dbms_output.put_line ('VALUE of i' | I);
    13. b: = substr (a, i, 1);
    14. Dbms_output.put_line ('VALUE OF b' | b);
    15. end loop;
    16. end;
    1. O/P
    2. anonymous block filled
    3. VALUE of i 1
    4. VALUE OF b 0
    5. I VALUE 2
    6. VALUE OF b
    7. I VALUE 3
    8. VALUE OF b

    I should get the O/P as

    anonymous block filled

    VALUE of i 1

    VALUE OF b 3

    I VALUE 2

    VALUE OF b 7

    I VALUE 3

    VALUE OF b 1

    This is the output that I would expect if line 15 has

    b: = substr (arm , i, 1);

    but not when you take the character of the i - th one.

    Moreover, if one (or arm) and b are numbers, then you can consider using number functions, like TRUNC and MOD, might be a better way to get individual numbers - assuming that you really need to get the individual numbers.  It is often a symptom of a bad design, where the number is actually a composite of what must be in multiple separate columns.

    SUBSTR expects its first argument to be a string.  If you really must call SUBSTR, then its better to ouse TO_CHAR to explicitly convert the number of strings.

  • WPSM54G cannot find print server and not able to print the test page

    After several days of trial and error I am so far I'm willing to give up and put this peace of equipment for sale. It is my last attempt to find a solution.

    I have a Canon MP510 printer connected to the print server and I managed to configure the print server so that it establishes a wireless connection to the router. I can see the ip address assigned to my router print server and I can log on to the configuration of the print server page.

    When I want to set up your computer (software print copy of the Canon MP510 print server) I can not complete the wizard. Step 1 is successful. It shows the print server and the MP510 related to port 1, but in step 2, I get a message that the print server can not be found.

    I looked on the forums how to solve. I already tried a fixed ip address to configure the printer manually but not any which solution worked.

    Your print server must be set to a fixed IP address, try this IP address: 192.168.1.78... Disconnect ethernet cable between your router and the PS... Both devices power for one minute cycle... Follow the link here after changing the IP address on the PS...

  • Not able to access the constant value of package in oracle reports

    Hello

    I created the package with the constant variables in the database

    CREATE or REPLACE PACKAGE cls_vars AS

    -Constants

    const_yes CONSTANT VARCHAR2 (1): = 'Y ';

    const_no CONSTANT VARCHAR2 (1): = 'n';

    const_active CONSTANT VARCHAR2 (1): = 'A ';

    const_inactive CONSTANT VARCHAR2 (1): = 'I ';

    end;

    I created the function of oracle reports, please see the code below

    function CF_CONSTINACTIVEFormula returns the Char type is

    L_const_inactive VARCHAR2 (10);

    Start

    RETURN cls_vars .const_inactive;

    EXCEPTION

    WHILE OTHERS THEN

    RETURNS A NULL VALUE.

    end;

    When I compile this code in the oracle reports, I get this error "cannot directly access remote variable or cursor.

    We can not directly get/set a variable (or constant) in a package to database forms and reports module.

    We must use the procedures/functions to get/set accessor. For example:

    CREATE or REPLACE PACKAGE cls_vars AS

    -Constants

    const_yes CONSTANT VARCHAR2 (1): = 'Y ';

    const_no CONSTANT VARCHAR2 (1): = 'n';

    const_active CONSTANT VARCHAR2 (1): = 'A ';

    const_inactive CONSTANT VARCHAR2 (1): = 'I ';

    FUNCTION get_const_yes RETURN VARCHAR2;

    ...

    END;

    /

    CREATE or REPLACE PACKAGE BODY cls_vars AS

    FUNCTION get_const_yes RETURN VARCHAR2 IS

    BEGIN

    RETURN const_yes;

    END;

    ...

    END;

    /

    Kind regards

    Zlatko

  • Not able to display the default value

    Hello

    I am new to writing expressions in CRM OD. I try to display a default value for the opportunity status = 'pending' when we create a new opportunity. I wrote the script as < status [>] = ValRech ("OPTY_STATUS", "pending") to dafault value deposited on the occasion, introduced the edition page setup. But it does not work. When I create a new opportunity, opportunity status field remains empty. Can someone help me where I'm wrong?

    Likewise, I want to display a field ID, so that when a user create a new opportunity this field should get filled with a unique value by default by the system. Please let me know what script should I write for this.

    Any help would be appreciated.

    Try typing simply waiting (without the quotes) in the default, you needn't even click the Fx button.

  • not able to print the PDF file, refused permission for the passport application?

    I try to print a DS 82 to use an application for renewal of Passport online. When I get to the printing part he refuses saying that I don't have permission to print this page. Any tips? It's my computer, and I went through the security sections in the Panel. I use Windows 7 Pro

    What browser are you using, IE?

  • OfficeJet 6600. Works as a printer, but not able to start the scanner.

    OfficeJet 6600. Works as a printer, but not able to start the scanner.

    I am facing a strange behaviour of my camera. I tried to find similar problems on the forum, but did not succeed.

    I started it 2 days (near my 5610 old which seems to have problems of aging). I use a Sony VAIO PC, OS Win7-Pro, updated.

    Running the appliance following the instructions of the poster. Presents the installation CD. Wireless net was successful and the screen of the device is to give the corresponding IP address.

    But this IP has realized the configuration SW is not recognized. I tried thousands of times, switching and on different devices (router, printer and pc) in the order required, uninstall and reinstall the device.

    However, despite the property intellectual not recognized the device functioning as a "printer".

    But I need to use it as a scanner.

    Procedure by selecting the "scan to PC" screen of the device (only available as an option) I get the message "to ensure that the feature is turned on" and I am prompted to 'open the printer HP SW,... '. ».

    Go to Windows and by clicking on "HP SCAN" in the HP/HP Officejet 6600 directory I get the a warning window stating "HP Officejet unidentified 6600.

    Can someone, please?

    Thank you in advance.

    Hey,.

    Try this document! A "no computer has detected" or "Connection error" message when scanning for HP Officejet 6600 e-all-in-one and 6700 Premium e-All-in-One Printer Series (H711)

    Have a great day!

  • I am able to scan, but unfortunately not able to print on the printer DJ1515.

    Original title: Do not print to the printer.

    My DJ1515 printer after the success of the download, I was able to scan, but unfortunately not able to print. Need help how to solve this problem. Thank you

    You need to provide a little more information... and it is unclear what you mean by "after successful download" even though I think you mean that you believe that you have successfully installed the printer.

    Is your printer: http://h10025.www1.hp.com/ewfrf/wc/product?cc=lamerica_nsc_carib&dlc=en&lang=en&lc=en&product=5385208 (this model seems to be sold in Latin America and the Caribbean)?

    What version of Windows (XP Home, XP Pro, etc.) and service pack (none, 1, 2, 3) do you have?  Do right click my computer and select properties for info.

    Your printer is connected to your computer by USB, correct?

    When you installed the printer did you leave the printer NOT connected until you are prompted to connect by the installation software or did you first connect the printer to the computer and then install the software?

    What happens when you try to print? If you get an error message, please provide the full text without paraphrase.

    Please describe the status of the lights on the front of the printer (on/off/flashing).  Lights are on 1, 5 and 6 in the figure below:

    Click Start > printers and faxes
    Is there an icon for your printer?  If Yes, it looks like the following (except with the name of your printer instead of "hp Laser Jet 1300 PCL" 5th)?


    It's

    • Is there a circle with a check mark?
    • Is there a 0 in the second row?
    • The third line says 'ready '?

    What happens if you right cliquer click on this icon, select properties and then click on the button "Print Test Page"?

    What happens when you follow these steps:

    • Click Start > all programs > HP > HP Deskjet 1510 Series > Series HP Deskjet 1510 (note that the wording in your Start Menu may show instead of 1510-1515)
    • When the printer software opens, click on 'Print and scan' and then click on "maintain your printer.
    • When the printer Toolbox opens, click on 'Print the diagnostic information' in the tab 'device reports.
  • I can print Microsoft Word and Excel documents, but I am not able to print from the web. I get an error message that says: "Activation - Code 20' - error"Printer Not Activated".

    Activate printer F4580

    I run Microsoft Vista.  I have a printer HP F4580.  I can print Microsoft Word and Excel documents, but I am not able to print from the web.  I get an error message that says: "Activation - Code 20' - error"Printer Not Activated".  What should I do to correct this?

    Hello

    ·          What browser do you use to connect to the Internet?

    The error may occur if the wrong printer is set as default, the printer driver printer is missing, or if there are conflicts in Device Manager.

    Step 1: Make sure that the desired printer is set as the default printer:

    http://Windows.Microsoft.com/en-us/Windows7/change-your-default-printer

  • Printers / HP Photosmart 5520: my printer asked a password am not able to find the password or reset an another pls help

    my printer was asking a password am not able to find the password or reset an another pls help

    I've used it since December when I bought the printer, but I just changemy internet company

    It was when he said ask for password which i don't remember not pls help.

    I can be paid to [personal information deleted]

    Hi @funmi09

    I want to help you set up your printer for your internet company recently changed. This document provides the steps necessary to find the WEP key or WPA or your wireless network password.

    Once you retrieve your password, the following will help you to configure the printer; Connection of the printer after you have changed your wireless network.

    If you still can't find your password, you will need to contact your ISP (internet service provider).

    I hope this helps.

  • Not able to get the value of the type defined in the other program

    Hi all

    I have create a type in a single package spec (Globally), now I'm using the same type in another package. Simply I'm calling the first package and try to store the value in the Type and use the same type in the second package.

    But I'm not able to get the value

    Type declaration

    Declared in package Spec
    
    TYPE t_aa_derive_tbl_type IS TABLE OF xxxx%ROWTYPE;
       t_aa_derive t_aa_derive_tbl_type;
    

    Package 1

    Package1. PROCEDURE name(
    some parameters);
    is
    Cursor
    c1 is Select * from dual;
    
    begin
          OPEN c_aa_derive;
            FETCH c_aa_derive
            BULK COLLECT INTO t_aa_derive;
            CLOSE c_aa_derive;
           
         END get_aa_derive;
    

    In my second package

    I'll call you

    Package1. PROCEDURE name(
    some parameters);
    
    and then i am trying to
    
    for i in 1 .. package1.t_aa_derive.COUNT
      LOOP
    
    ....
    
    ....
    ...
    
    end loop;
    

    I can not entered the loop for some reason any.

    Could someone guide me if anything I missed.

    See you soon,.

    San

    And what did you like refcursor c_aa_derive in the call to package1.name? Is it returns all rows? If this isn't the case, COUNT will be 0.

    SY.

Maybe you are looking for