<div dir="ltr">I also came across the problem of purging linefeeds and carriage returns from incoming data. I found it frustrating that neither "instr()" nor "xlate()" could find or replace the pesky intruders.<br><br>I ended up scripting this character-by-character search for them instead. It seemed to do the trick.<br><br><div class="gmail_extra"><br> 29 ------- - - - - - - - - - - - - - - - -<br>cleands ■ If: ' look for linefeed characters (ASCII=10) ■<br> Then: sp = chr("10") ■<br> 30 ------- - - - - - - - - - - - - - - - -<br> ■ If: ■<br> Then: gosub filtstr ■<br> 31 ------- - - - - - - - - - - - - - - - -<br> ■ If: ' look for carriage return characters (ASCII=13) ■<br> Then: sp = chr("13") ■<br> 32 ------- - - - - - - - - - - - - - - - -<br> ■ If: ■<br> Then: gosub filtstr ■<br> 33 ------- - - - - - - - - - - - - - - - -<br> ■ If: ■<br> Then: return ■<br><br><br><br> 34 ------- - - - - - - - - - - - - - - - -<br>filtstr■ If: ■<br> Then: ps = "1" ■<br> 35 ------- - - - - - - - - - - - - - - - -<br>test_ds■ If: mid(ds,ps,"1") = sp and ps eq "1" ■<br> Then: ds = mid(ds,(ps + "1"),dlen(ds)) ■<br> 36 ------- - - - - - - - - - - - - - - - -<br> ■ If: mid(ds,ps,"1") = sp and ps gt "1" ■<br> Then: ds = mid(ds,"1",(ps - "1")) & mid(ds,(ps + "1"),dlen(ds)) ■<br> 37 ------- - - - - - - - - - - - - - - - -<br> ■ If: ■<br> Then: ps = ps + "1" ■<br> 38 ------- - - - - - - - - - - - - - - - -<br> ■ If: ps gt dlen(ds) ■<br> Then: return ■<br> 39 ------- - - - - - - - - - - - - - - - -<br> ■ If: ■<br> Then: goto test_ds ■<br><br><br><div class="gmail_quote">On Mon, Aug 28, 2017 at 4:27 PM, Brian K. White via Filepro-list <span dir="ltr"><<a href="mailto:filepro-list@lists.celestial.com" target="_blank">filepro-list@lists.celestial.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 8/28/2017 3:16 PM, Fairlight via Filepro-list wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
They call it -logic-. ...<br>
</blockquote>
<br>
I don't see that Mike did anything wrong deserving of these responses.<br>
<br>
He's not a programmer and lacked the background to make sense of your initial answer. That is not illegal. Once you establish that, just switch into that mode.<br>
<br>
<br>
Mike, this kind of thing can be addressed several possible ways, and Mark's first answer was really just meant as a general description or basic outline of one possible approach, not any kind of exact commands or details. No one could offer any exact details yet at that point because we didn't yet know enough details about your situation. First comes picking a possible approach, then comes hashing out what exact details are required to make that happen.<br>
<br>
That idea might not have been practical for you for some reason, or might be doable but might not be the most convenient option available. It was too early at that point to do more than essentially spitball some different basic possible approaches.<br>
<br>
For instance:<br>
<br>
* If there are CR's or LF's or both within the cells, then how ARE the records delimited, if not by CR? Maybe you don't need to do anything but adjust the record delimiter option on the import command line in processing. That would be much better than cobbling together some external pre-processing steps.<br>
<br>
* Or, you could do your own more manual parsing of the data by using open and readline instead of import. Then you could detect incomplete records and read in the next line, and concatenate to the previously read line, repeat until you know you have read in a complete record (by counting the commas that weren't inside any quotes or something). This would not be convenient to write at all, but it's one and only advantage is, it would be done entirely in filepro processing and doesn't depend on any external programs or batch files, and once it's done, it's done. It'll then 'just work" forever.<br>
<br>
* Or, if you control the export, then maybe you could alter the export to make it possible for fp to import it reliably. (again, even this one idea, has many possible meanings. Impossible to guess them before even knowing the first thing: "if you control the export". Only IF that is true, the next question would be, what program are you exporting from? maybe that program has some option to specify the record delimiter, or if not, maybe you can add another column to the data that you could then look for in processing to detect the real end of the record. Or maybe you could export in a fixed-length format, and then the filepro import wouldn't even look at any LF or CR at all. They would just be bytes like any other bytes.)<br>
<br>
* Or maybe pre-processing the data is the most practical way to go after all.<span class="gmail-HOEnZb"><font color="#888888"><br>
<br>
-- <br>
bkw<br>
______________________________<wbr>_________________<br>
Filepro-list mailing list<br>
<a href="mailto:Filepro-list@lists.celestial.com" target="_blank">Filepro-list@lists.celestial.c<wbr>om</a><br>
Subscribe/Unsubscribe/Subscrip<wbr>tion Changes<br>
<a href="http://mailman.celestial.com/mailman/listinfo/filepro-list" rel="noreferrer" target="_blank">http://mailman.celestial.com/m<wbr>ailman/listinfo/filepro-list</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><i style="font-family:verdana,sans-serif">Robert Helbing<br>President<br>(626) 357-5315 x14</i><br><i style="font-family:verdana,sans-serif"><a href="http://www.airtro.com" target="_blank">www.airtro.com</a></i><br><br> <img src="https://docs.google.com/uc?export=download&id=0B-raId6UmY0EVmNrOFhuSmM0YVk&revid=0B-raId6UmY0ETlBqajQ1SzNYS1UvVE9jak51OXRab3FTZEdzPQ" width="115" height="104"> <img src="http://fieldapp.airtro.com/mailed/footer/AwardACCA.jpg" width="96" height="96"><img src="http://mail.airtro.com/LATReadersChoice.jpg" width="96" height="76"> <br></div></div></div></div>
</div></div><div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
<table style="border-top:1px solid #d3d4de">
<tr>
<td style="width:55px;padding-top:13px"><a href="http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-green-avg-v1.png" alt="" width="46" height="29" style="width: 46px; height: 29px;"></a></td>
<td style="width:470px;padding-top:12px;color:#41424e;font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">Virus-free. <a href="http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" target="_blank" style="color:#4453ea">www.avg.com</a>
</td>
</tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"></a></div>