Converting FileMaker Pro carriage returns

I have a text field in a FileMaker Pro database that contains carriage returns. After exporting the contents of the field to a csv file and importing it into Servoy, how can I loop through the records and replace the fmp carriage returns with carriage returns that Servoy will recognize.

An example of a loop method that can achieve this would be greatly appreciated.

can you first give me an small example of the CSV file?
So that i can see what the char is of the CR in the CVS file.

Embedded return $0D (decimal 13) or $0A (decimal 10) (hard wrap, not soft wrap) is exported as Vertical Tab character $0B (decimal 11).

Records are separated by EndOfLine characters CRLF $0D$0A (decimal 13 10, concatenated) for Windows PC.

Attached is a zipped Export.csv file that contains one field with two records. In the first record the carriage returns appear before the words “coinsurance” and “limit”. In the second record the carriage return appears before the word “on”.

with a simple javascript you can make then linebreaks again:

var tst = youreTxt;
while(tst.indexOf(’ ‘) != -1)
{
tst = tst.replace(’ ‘,’\n’)
}
youreTxt = tst;

(that special char i copy pasted from the cvs file)

Thank you very much Johan. That’s exactly what I needed.

I am now trying to import a .mer file into Servoy that was exported from FileMaker Pro. Everything works fine except for the FileMaker carriage returns within fields.

The above loop from this earlier thread takes care of the FileMaker carriage returns within a field after an import, but I would like to take care of them before importing by doing a find and replace in the .mer file. I have tried numerous substitute characters, but they all break the import. What character should I be using as the “replace” character? Has anyone else succeeded in doing this with a .mer file?

Good morning all

Trying to import a large .CSV text file and restore the CR’s but can’t get Johan’s code to work.

Thought that maybe Servoy functionality might have changed since original post in Feb but also can’t get ‘StringReplace’ to work.

Probably brain-fade so would appreciate anyone pointing me in the right direction.

.

globals.gtext01 = detail;
utils.stringReplace(globals.gtext01, ’ ‘,’\n’);
detail = globals.gtext01;

/* // Johan’s original script
var tst = detail;
while(tst.indexOf(’ ‘) != -1)
{
tst = tst.replace(’ ‘,’\n’)
}
detail = tst;

*/

Thanks in advance

Graham Greensall
Worxinfo Ltd

Servoy Developer
Version R2 2.2rc3-build 321
Java version 1.5.0_02-b09 (Windows XP)

This code worked fine for me:

your_txt = utils.stringReplace(your_txt,‘\x0B’,‘\n’);

hope it helps…

Hi Graham, was looking more deeply to your code.. and found your slip…

grahamg:
globals.gtext01 = detail;
utils.stringReplace(globals.gtext01, ’ ‘,’\n’);
detail = globals.gtext01;

should be:

globals.gtext01 = detail; 
global.gtext01 = utils.stringReplace(globals.gtext01, '','\n');
detail = globals.gtext01;

or more easily:

detail = utils.stringReplace(detail, '','\n');

unless you need globals.gtext01 for something else?

Grazie molto Enrico

Appreciate your help. However still couldn’t get this to work:

detail = utils.stringReplace(detail, ‘\x0B’,‘\n’);

But after setting up another text field [detail2] it works every time

detail2 = utils.stringReplace(detail, ‘\x0B’,‘\n’);

Sorted now but strange behaviour :?

Thanks again

Graham Greensall

Hi,
I would suggest doing what I did, and that is to use a tool for the back-end database that you do a SQL update like

update contacts set customer_history = replace( customer_history , '\x0B' , '\n');

This is for SybaseASA, but I’m sure there is an equivalent command in most dbs. This should happen MUCH faster than doing it in Servoy, and the single command happens to all records in the db.

Rafi.

Hey Rafi, I know you posted this a long time ago, I just found it and it helped a ton with a problem I’ve been having with a filemaker export to servoy.. Thank you very much. I used interactivesql on the server and after a nervewracking pause, and an enforced restart of servoy server - my notes fields now have proper returns wooooooooohooooooooooooo Thanks

Hi,
no problem and I’m glad it helped. Sometimes one just has to resort to doing things in the back-end, as wonderful as Servoy is.
I had a MASSIVE amount of FM data that needed tweaking, and iSQL was very useful.
If you have any other queries about FM to Servoy migrations, I’m (one of) the man (men).

Rafi.

rafig:
Hi,
I would suggest doing what I did, and that is to use a tool for the back-end database that you do a SQL update like

update contacts set customer_history = replace( customer_history , '\x0B' , '\n');

This just saved me a lot of time also. I created one line like the above for each of 90 columns. For 5,600 records, all ninety columns were updated in 14.6 seconds, with one click of the mouse. Thank you!