Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Not able to print decimal values in tabular form

Apex Dev82Jan 7 2016 — edited Jan 8 2016

Hi All,

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

I am using AJAX and JavaScript to calculate the difference dynamically.

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

if col1-col2 = 1.2 - able to print

if col1-col2 = 0.2 - error, unexpected token

error_07012016.PNG

--AJAX code:

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 : executes on page load

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

This post has been answered by ApexNewLearner on Jan 8 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 5 2016
Added on Jan 7 2016
3 comments
357 views