mibuso.com

Microsoft Business Solutions online community
It is currently Wed Jun 19, 2013 11:52 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: [Solved] How can I erase CRLF characters and export to .TXT
PostPosted: Wed Jun 06, 2012 8:40 am 
Offline

Joined: Mon Oct 17, 2011 1:26 pm
Posts: 17
Country: Greece (gr)
Hello, I've been trying to export some fields through a dataport to a .TXT file.
On the OnBeforeExportRecord trigger of the Dataport I want to clean
my text fields from CR & LF characters that are attached to the end of the Code fields.

So I have tried all these:
c --> char = 13

1) "Dimension Value".Code:= DELCHR("Dimension Value".Code, '=', FORMAT(c));

2) Adding two Backspace [char=8] characters to the end of the "Dimension Value".Code

3) "Dimension Value".Code:=COPYSTR("Dimension Value".Code, 1, STRLEN("Dimension Value".Code)-2);

When I run the Dataport to export data in a .TXT file, the green processing bar gets stuck permanently and does not finally export the data.

Has anybody managed to export data cleaned from CRLF characters?

Any help would be highly appreciated.

_________________
* Shish_kebab_feels_right_for_breakfast *


Last edited by ILME on Thu Jun 07, 2012 10:03 am, edited 1 time in total.

Top
 Profile E-mail  
 
 Post subject: Re: How can I erase CRLF characters and export to .TXT
PostPosted: Wed Jun 06, 2012 9:55 am 
Offline

Joined: Sat Jan 28, 2012 4:48 pm
Posts: 56
Country: Netherlands (nl)
Try the OnAfterFormatField trigger (hit F9 on a dataport field in the Field designer)


Top
 Profile  
 
 Post subject: Re: How can I erase CRLF characters and export to .TXT
PostPosted: Wed Jun 06, 2012 10:07 am 
Offline

Joined: Sat Oct 08, 2005 11:22 am
Posts: 499
Location: TURKEY
Country: Turkey (tr)
Following code should work:

Code: Select all
cr := 13 ;
lf := 10 ;
FieldToClean := DELCHR(FieldToClean,'=',FORMAT(cr)) ;
FieldToClean:= DELCHR(FieldToClean,'=',FORMAT(lf)) ;


IF not, there may be another problems and you may require debugging.

_________________
Ufuk Asci
Pargesoft


Top
 Profile  
 
 Post subject: Re: How can I erase CRLF characters and export to .TXT
PostPosted: Thu Jun 07, 2012 9:59 am 
Offline

Joined: Mon Oct 17, 2011 1:26 pm
Posts: 17
Country: Greece (gr)
@BernardJ:
unfortunately, putting the altering DELCHR code in the OnAfterFormatField doesn't do the job, because it exports the data unchanged (with CRLF characters in it)

@ufuk:
Yes, that's what I was doing but it couldn't export the file.

************
Finally I solved it!
For a mysterious reason that I cannot understand,
I've put a VARIABLE instead of the field and IT WORKED!

So, I put:
variable_code:= DELCHR("Dimension Value".Code, '=', FORMAT(c));

and exported THE VARIABLE instead of the "Dimension Value".Code FIELD

If anyone has any idea why it works properly with a variable and not with the field
I'd be glad to know!

Thanx

_________________
* Shish_kebab_feels_right_for_breakfast *


Top
 Profile E-mail  
 
 Post subject: Re: How can I erase CRLF characters and export to .TXT
PostPosted: Thu Jun 07, 2012 10:17 am 
Offline

Joined: Sat Oct 08, 2005 11:22 am
Posts: 499
Location: TURKEY
Country: Turkey (tr)
It also works with fields not only variables. If you want to modify a value in primary key fields you should use Rename function. This may be the reason.

_________________
Ufuk Asci
Pargesoft


Top
 Profile  
 
 Post subject: Re: How can I erase CRLF characters and export to .TXT
PostPosted: Thu Jun 07, 2012 11:11 am 
Offline

Joined: Mon Oct 17, 2011 1:26 pm
Posts: 17
Country: Greece (gr)
ufuk wrote:
It also works with fields not only variables. If you want to modify a value in primary key fields you should use Rename function. This may be the reason.


what you said was so correct and helpful!
Thank you very much

_________________
* Shish_kebab_feels_right_for_breakfast *


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: