Hi,
I'm rather new to Navision.
I'm asked to import data with a Dataport. The data imported does not always have the same format, as different users enter their data (everyone on his/her own way).
For example:
<= 50000
<= 50.000
<=50000
<=50.000
I need all this input in the same format:
* A space between the <, >, = and the actual number
* thousand-seperator
* decimal seperator
Both the input and the result are of type: Text
Is there a way to automate this with a pre-defined function or do I need to write a routine that checks the input-string character by character and adjust it as specified?
Please give me some information so I know how to solve this problem.
Thanks in advance!
0
Comments
In the beginning of the Dataport call this function:
For Import, you must import all Decimals in Text variables and after that you must evaluate original fields:
Navision Solution Developer
Intelligent Systems Bulgaria
I think it's a usefull function that I am defenitly gonna use.
However, I don't know in advance what the user is going to enter.
For instance, the user needs to enter a value Less than 45000
It's possible the user enters:
<45000
But it's also possible that he will enter
< 45000 (or some other variant).
In order to get it into our database correctly, I need to format it to the same result, no matter what variant the user chooses.
The end-result I need to achieve must be:
< 45.000
My question now is:
How can I check wheter the space is present or not, and how to I insert one if the user omited it.
Same goes for the thousand-seperator. If the user didn't enter a thousand-seperator, I need to insert it myself.
Is this possible?
for the number you can evaluate it into a decimal variable and use FORMAT function to put thousand and descimal separator that you want.
For example:
Navision Solution Developer
Intelligent Systems Bulgaria
With your advice I managed to write the function I need.
=D>
Kind regards,
I have, in a text file a decimal field with this format:
127.53
where 127 is integer part
and
53 is decimal part
I want to insert it in a decimal variable and table field of Navision but it depends of regional settings.
I don't want it depends by Regional Setting. How is it possible?
I want alway 127.53 and not for example 127530.
Thank you very much
When importing a text file, you must use EVALUATE instead of FORMAT. But first of all, you must convert decimal separator from "." to your separator, depending Regional Settings. It's simple:
//Find you decimal separator:
Str := FORMAT(123/2);
DecSep := COPYSTR(str,2,1);
//Read column form the text file in a text variable (for example ValueText), and convert '.' with your decimal separator:
IF decsep <> '.' THEN
ValueText := CONVERTSTR(ValueText,'.',DecSep);
//Convert the text variable to your decimal field:
EVALUATE("Decimal Field",ValueText);
Navision Solution Developer
Intelligent Systems Bulgaria
It seems correct but for having the decimal separator in the example the right code is:
DecSep := COPYSTR(str,3,1);
Have a nice day.
Anyone is meet with this error message?
FORMAT is not a function??? ](*,)
I do not know where shoud be the problem.
I have tried in an individually codeunit Format and there is working... could I mistake something??
This source is standard code of Item table, Costing Method OnValidate trigger.
Anyone have an idea what is this?
Thank you!
A
Okay, sorry, it was solved. recompile all objects! there was a new variable in a local function with the same name. Im .... :oops:
Is not good idea to use system words for naming fields, functions,...
Navision Solution Developer
Intelligent Systems Bulgaria