How do I avoid junk characters while exporting mfgpro data?

jchellap

Member
I am trying to generate a .csv file from ca_mstr data.

While exporting data from ca_mstr some fields having junk character and it is creating issues with .csv file.

Can anyone suggest me how to resolve this issue?
 
What are the junk characters? I've no idea for mfgpro itself, but in Progress code you could create a list of characters that are invalid and replace any occurrences with a space (or any other character) using the REPLACE() funtion.
 
how are you exporting .. are you using PAGE anywhere within your exprot logic to page the output ?
 
No, Its simple extract for e.g.

output to ca_mstr.csv.
for each ca_mstr no-lock:

export delimiter "|" ca_mstr.
end.
output close.
 
for eg: closed small sqare is one of the junk character.

And they are not visible if you display and will get exported when you export.
 
So it's unprintable characters.

You'll have to play around with the bounds of this, but you can work out which CHR() value it is with this code.
Code:
DEFINE VARIABLE lv-Char AS CHARACTER   NO-UNDO.
DEFINE VARIABLE lv-i    AS INTEGER     NO-UNDO.
DEFINE VARIABLE lv-Temp AS CHARACTER   NO-UNDO.

lv-Char = "Aa!~"£$%^&*()" + CHR(1) + "Zz".

DO  lv-i = 1 TO LENGTH(lv-Char,"CHARACTER"):
  lv-Temp = SUBSTRING(lv-Char,lv-i,1).
  IF ASC(lv-Temp) LT 33 OR ASC(lv-Temp) GT 163 THEN
  MESSAGE ASC(lv-Temp) lv-Temp
    VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
Once you've worked out what it is you can replace them in the output with a printable character.
 
i'm not familiar with mfgprog myself... but do you see a reason for these data to be valid ?
what are these fields and do they display correctly when viewed from with in the MfgPro application ?
 
Once I had a problem with users copying/pasting text they have selected on a HTTP page into a Progress fill-in widget. Some times there were some extra characters that ended up in the database. At that point we implemented generic logic in the business logic layer which automatically trimmed that characters. The ABL TRIM function usually does the trick, but only if these characters are leading or trailing ...

If that is not sufficient you will need to parse that strings and, depending on the code page you are using and your definition of what invalid characters are, strip them off before you export them.

Heavy Regards, RealHeavyDude.
 
Back
Top