Leading and trailing spaces in dataport

dolecdolec Member Posts: 12
edited 2003-08-28 in Navision Financials
Hi,

In 2.60 I've written a dataport which reads a text into the text variables:

txtText1 1 250
txtText2 251 251
txtText3 502 251

The problem is that the dataport omits leading and trailing spaces in the text variables. So that if I write them back by command:

file.WRITE(FORMAT(txtText1,250)+FORMAT(txtText2,251)+txtText3);

The line is shorter and incorrect :(

Does anybody know how to avoid this problem?

Thanks

Comments

  • borsicsjborsicsj Member Posts: 32
    Hi,

    maybe you should format the last string also. In my mind the command you described should be the following:

    file.WRITE(FORMAT(txtText1,250)+FORMAT(txtText2,251)+format(txtText3,251));

    This should be corrert for the system.

    It's better to use a separated file instead of fixed length text. I always do this.


    [
    quote="dolec"]Hi,

    In 2.60 I've written a dataport which reads a text into the text variables:

    txtText1 1 250
    txtText2 251 251
    txtText3 502 251

    The problem is that the dataport omits leading and trailing spaces in the text variables. So that if I write them back by command:

    file.WRITE(FORMAT(txtText1,250)+FORMAT(txtText2,251)+txtText3);

    The line is shorter and incorrect :(

    Does anybody know how to avoid this problem?

    Thanks[/quote]
    Brg,

    --
    János Borsics
  • dolecdolec Member Posts: 12
    Thank you borsicsj,
    but this can't solve the problem. The spaces are omitted just after the text is written into txtText1,..2,..3.

    For example (can be inconveniently formatted by your browser):

    input text = " aaa bbb ccc ddd eee fff "
    ... in OnBeforeEvaluateField the variables have this values:
    txtText1 = "aaa bbb"
    txtText2 = "ccc ddd"
    txtText3 = "eee fff"

    ... and I want to obtain this:

    txtText1 = " aaaa bbb "
    txtText2 = " ccc ddd "
    txtText3 = " eee fff "


    Thank you for your help
  • dolecdolec Member Posts: 12
    uuh!! again:


    Thank you borsicsj,
    but this can't solve the problem. The spaces are omitted just after the text is written into txtText1,..2,..3.

    For example (can be inconveniently formatted by your browser):
    input text = "        aaa bbb                                                                                                                                                                                                                                                                     ccc ddd                                                                                                                                                                                                                                 eee fff           "
    ... in OnBeforeEvaluateField the variables have this values:
    txtText1 = "aaa bbb"
    txtText2 = "ccc ddd"
    txtText3 = "eee fff"
    
    ... and I want to obtain this:
    
    txtText1 = "        aaaa bbb                                                                                                                                                                                                                                         "
    txtText2 = "                            ccc ddd                                                                                                                                                                                                                       "
    txtText3 = "          eee fff           "
    
    
    Thank you for your help[/code]
  • heinsohnheinsohn Member Posts: 15
    Hi Dolec,

    only an idea, have you already thought about the following:

    before import : replace all space by a special-character?
    and
    after import : replace this special-character by space.

    best regards

    Rolf Heinsohn
    Rolf

    - Only happy people can have success -
Sign In or Register to comment.