I have a string formula to create a fixed length export .txt
file, but the last field in the record is a variable length field. If the last field length is less than the maximum for that field the result produces a record that is less than the required record length.
I have allowed for the varying field length with the following string formula:
if
length ({db.field}) <14
Then left ({db.field},length ({db.field}))& space (14- length ({db.field}))
else
Left ({db.field},14 )
but the additional spaces don't come through in the end result txt file.
I have also tried adding a chr(13)at the end of the string.
if
length ({db.field}) <14
Then left ({db.field},length ({db.field}))& space (14- length ({db.field})) & chr(13)
else
Left ({db.field},14 ) & chr(13)
The result solves the problem of the length of the last field, but also adds the ascii character "?"at the end of the record so that the record length of the final product is now one character longer than required. This txt file is being imported into a client's accounting system, so a file with an extra character at the end of the record won't work.
Does anyone know how to get around this?
What I need to produce is a 14 character string (with following spaces if the field is less than 14):
BRIDGEWAY ST
instead of this result
BRIDGEWAY ST ?
file, but the last field in the record is a variable length field. If the last field length is less than the maximum for that field the result produces a record that is less than the required record length.
I have allowed for the varying field length with the following string formula:
if
length ({db.field}) <14
Then left ({db.field},length ({db.field}))& space (14- length ({db.field}))
else
Left ({db.field},14 )
but the additional spaces don't come through in the end result txt file.
I have also tried adding a chr(13)at the end of the string.
if
length ({db.field}) <14
Then left ({db.field},length ({db.field}))& space (14- length ({db.field})) & chr(13)
else
Left ({db.field},14 ) & chr(13)
The result solves the problem of the length of the last field, but also adds the ascii character "?"at the end of the record so that the record length of the final product is now one character longer than required. This txt file is being imported into a client's accounting system, so a file with an extra character at the end of the record won't work.
Does anyone know how to get around this?
What I need to produce is a 14 character string (with following spaces if the field is less than 14):
BRIDGEWAY ST
instead of this result
BRIDGEWAY ST ?