Login
Register
Search
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Forums
Integration / Customization
IPA/ProcessFlow
javascript line
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Who's On?
Membership:
Latest:
Jeffin Joy
Past 24 Hours:
0
Prev. 24 Hours:
0
Overall:
4988
People Online:
Visitors:
32
Members:
0
Total:
32
Online Now:
New Topics
Top Forum Posters
Name
Points
Greg Moeller
4184
David Williams
3349
Kat V
2984
Woozy
1973
Jimmy Chiu
1883
Kwane McNeal
1437
Ragu Raghavan
1377
Roger French
1315
mark.cook
1244
Chris Martin
825
Forums
Filtered Topics
Unanswered
Unresolved
Active Topics
Most Liked
Most Replies
Search Forums
Advanced Search
Prev
Next
Forums
Integration / Customization
IPA/ProcessFlow
javascript line
Please
login
to post a reply.
4 Replies
0
Subscribed to this topic
53 Subscribed to this forum
Sort:
Oldest First
Most Recent First
Author
Messages
TommyT
Veteran Member
Posts: 58
3/1/2011 1:05 PM
Im having trouble with a piece of java_script....it needs one more line
dcell= "+" + addLeadingZeros(dcell,12);
if (DED_DED_AMT< 0 ){
dcell = DED_DED_AMT;
dcell= "-" + addLeadingZeros(dcell,12);
}
I need to display numbers in a format of +000000001.23.
Certain numbers will be negative and need to be displayed as -00000001.23
The code does everything right except when a number is negative it
is displaying -0000000-1.23
Can anyone help me with the line or 2 of code I need?
Robert Spurr
Veteran Member
Posts: 130
New Poster
Congrats on posting!
3/1/2011 3:51 PM
Split
I think what you are doing is correct except that once you have determined the amount to be negative you need to convert it to a postive number before adding the zeros.
dcell = DED_DED_AMT * -1;
Hope this helps.
George Graham
Veteran Member
Posts: 201
3/1/2011 7:08 PM
Split
You could also use the absolute function - abs().
TommyT
Veteran Member
Posts: 58
3/1/2011 7:38 PM
Split
I tried that and got -10.00 (no padding) on my line.
Robert Spurr
Veteran Member
Posts: 130
New Poster
Congrats on posting!
3/1/2011 8:52 PM
Split
I did a quick test in Design Studio to be sure and the example below returned the results you desire. (-000000010.45)
Hope this Helps.
var dblNegative = -10.45;
var dblPositive = dblNegative * -1;
dblPostive = "-" + addLeadingZeros(dblPositive,12);
function addLeadingZeros(number,length)
{
var str = '' + number;
while (str.length < length)
{
str = '0' + str;
}
return str;
}
Please
login
to post a reply.