Dataport question...value to decimal return zero

kirkostas
Member Posts: 127
I have an Ascii file fixed length and it has a value 1000.00
I use a dataport to read it.
I want to enter this value to a decimal variable.
But always it takes 0.
I have made some tests.
I use a code variable and it returned ok.
I use evaluate function
How can i enter this value into my decimal variable?
I use a dataport to read it.
I want to enter this value to a decimal variable.
But always it takes 0.
I have made some tests.
I use a code variable and it returned ok.
I use evaluate function
evaluate(mydecimal, mycode);and it returned 0 again.
How can i enter this value into my decimal variable?
kirkostas™
0
Comments
-
Are you sure "mycode" has a value when you use EVALUATE?Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Yes it has a value, I can see it by using
message(format(mycode));
It returns 1000.00 but when i do evaluate i get this error message
Decimal must not be blank.
Decimal is missing or invalid on the expression.kirkostas™0 -
kirkostas wrote:Yes it has a value, I can see it by using
message(format(mycode));
PS you should use message('%1',format(mycode));
the first parameter is a formatting string, so it is possible your value is interpreted.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
It returns 1000.00 but when i do evaluate i get this error message
Decimal must not be blank.
Decimal is missing or invalid on the expression.kirkostas™0 -
Hi
May be problem in separator - what this code return? MESSAGE('%1',FORMAT(3/2)[2])0 -
It returns comma (,)
My number is 1000.00 (dot).
How can I convert it?
Just replace (.) dot with (,) comma?
So simple?
I tried it but no I get the same error.
This is my original codeMESSAGE('%1',FORMAT(3/2)[2]); DebitNetAmt := CONVERTSTR(DebitNetAmt,'.',','); CreditNetAmt := CONVERTSTR(CreditNetAmt,'.',','); EVALUATE(DebitNetAmtDec,DebitNetAmt); EVALUATE(CreditNetAmtDec,CreditNetAmt); VALIDATE("Debit Net Amount",DebitNetAmtDec); VALIDATE("Credit Net Amount",CreditNetAmtDec);
DebitNetAmt and CreditNetAmt returns correct values but when I evaluate them to their decimal variables it crashes.kirkostas™0 -
Hi
Have 2 way
1. change region and language options
2. Just change '.' on FORMAT(3/2)[2] symbol0 -
Use this to clean the string from all 'dirty' characters. So you keep only a valid decimal string.
DebitNetAmt := DELCHR(DebitNetAmt,'=',DELCHR(DebitNetAmt,'=','1234567890.,'));
Afer this command, you can convert the "," to ".".Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Same error again ](*,)
//MESSAGE('%1',FORMAT(3/2)[2]); DebitNetAmt := DELCHR(DebitNetAmt,'=',DELCHR(DebitNetAmt,'=','1234567890.,')); CreditNetAmt := DELCHR(CreditNetAmt,'=',DELCHR(CreditNetAmt,'=','1234567890.,')); DebitNetAmt := CONVERTSTR(DebitNetAmt,'.',','); CreditNetAmt := CONVERTSTR(CreditNetAmt,'.',','); EVALUATE(DebitNetAmtDec,DebitNetAmt); EVALUATE(CreditNetAmtDec,CreditNetAmt); VALIDATE("Debit Net Amount",DebitNetAmtDec); VALIDATE("Credit Net Amount",CreditNetAmtDec);
and again theMESSAGE(DebitNetAmt);
returns 1000,00 correctly...
but when evaluate to decimal i get
Decimal must not be blank.
Decimal is missing or invalid on the expression.
Error... ](*,)kirkostas™0 -
Hi
I try and this work
str := '10000.01';
str := CONVERTSTR(str,'.',FORMAT(FORMAT(3/2)[2]));
MESSAGE(str);
IF EVALUATE(dec,str) THEN
MESSAGE('%1',dec);0 -
I think I got it.
If you have both debit and credit in the dataport, in general one of them is blank, so you need to do this:IF DebitNetAmt <> '' THEN EVALUATE(DebitNetAmtDec,DebitNetAmt); IF CreditNetAmt <> '' THEN EVALUATE(CreditNetAmtDec,CreditNetAmt);
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
kriki wrote:I think I got it.
If you have both debit and credit in the dataport, in general one of them is blank, so you need to do this:IF DebitNetAmt <> '' THEN EVALUATE(DebitNetAmtDec,DebitNetAmt); IF CreditNetAmt <> '' THEN EVALUATE(CreditNetAmtDec,CreditNetAmt);
Then just so
if EVALUATE(DebitNetAmtDec,DebitNetAmt) then ;
if EVALUATE(CreditNetAmtDec,CreditNetAmt) then ;0 -
Thank you Yaroslav Gaponov this was my problem =D>kirkostas™0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions