Format Text to Decimal

bublebuble Member Posts: 16
edited 2002-09-17 in Navision Financials
Hi,

how can I format a text field to decimal field.
I used the function COPYSTRING to copy a part from a text field. Now I will use the part of the text field for calculation.
Thanks for your support.

buble
Ciao
buble

Comments

  • BobBrownBobBrown Member Posts: 17
    EVALUATE
    Use this function to evaluate a string representation of a value into its normal representation. The system assigns the result to a variable.

    [Ok :=] EVALUATE(Variable, String)
    Ok

    Data type: boolean

    A return code which reflects whether an error occurred during the evaluation of the string.

    If Ok is...
    It means...

    TRUE
    No errors occurred during the evaluation of the string. The system assigned the value to Variable.

    FALSE
    Errors occurred during the evaluation of the string. The system did not modify the original value of Variable.


    If you omit this optional return value and an error occurs during the evaluation of the string, a run-time error occurs. If you include it, the system assumes you will handle any errors.

    Variable

    Data type: boolean, integer, option, date, time, text constant or code

    Any type of variable. The value of the string is assigned to the variable.

    String

    Data type: text constant or code

    A string containing a value of any simple C/AL data type.

    Example
    This example shows how the EVALUATE function works when called with three different types of variables.

    Value := '010196';
    Ok1 := EVALUATE(VarInteger, Value);
    Ok2 := EVALUATE(VarDate, Value);
    Ok3 := EVALUATE(VarYesNo, Value);
    MESSAGE(Text000 + Text001 + Text002,
    VarInteger, Ok1, VarDate, Ok2, VarYesNo, Ok3)

    Create the following text constants in the C/AL Globals window:

    Text Constant
    ENU Value

    Text000
    'VarInteger = #1######, and the return code is: %2\'

    Text001
    'VarDate = #3######, and the return code is: %4\'

    Text002
    'VarYesNo = #5######, and the return code is: %6'


    The message window shows:

    VarInteger = 10196 , and the return code is: Yes
    VarDate = 01/01/96, and the return code is: Yes
    VarYesNo = No , and the return code is: No

    This example shows that while the system can interpret Value ('010196') as both an integer and a date expression, it cannot interpret it as a boolean expression. This causes an error, shown in the return code Ok3 (=FALSE
Sign In or Register to comment.