Replace function doesn't recognize ¶ as [return] in the OLD text

I need to replace some line endings with tab in text imported through the clipboard, and the PanX “Replace” function doesn’t seem to recognize the ¶ character as a return. The same procedure worked fine in Pan6.

Chances are the imported text is using line feeds as the line ending, and not carriage returns. It worked in Panorama 6, because the clipboard converted those line feeds to carriage returns, but in Panorama X, they are being left as line feeds.

Use

replace(lftocr(clipboard(),¶,¬)

instead of

replace(clipboard(),¶,¬)

The lftocr( function will ensure that the line endings are carriage returns, before you do the replace.

Or simply:
replace(clipboard(),lf(),¬)

My data apparently did contain linefeeds, and switching to lf() seemed to take care of that problem. My bigger problem now, though, is that that database now crashes the computer whenever I try to open it, so I can’t even look at it to try to see what’s happening. Is there any way of getting Panorama to open an apparently corrupted database?

You could try running a procedure from another database with just openplain as the code. This will call the normal Open dialog except the chosen file will simply open to the datasheet. If this does not work you can always use Time Machine to get an earlier version of the file before the problem showed up. I have done this myself to save a totally mucked up database that I thought I might have lost forever.

Thanks Gary. I was just about to pull a backup version to replace the problem file but I tried openplain and that worked fine. That’s a handy command to know about.

You don’t need to write a procedure with openplain – I’ve already done that for you. Simply use the Find & Open dialog, locate the file, then right click on the file and choose Open Data Sheet Only.

OK Thanks. That’s nice to know.

This explained why I could not find the carriage return char in some text in a field, thanks. Yes, it seems my text also has line feeds instead of returns. So, Why?

I copy the text from a google doc and paste it into a field in Panorama X. If I then copy the text from the field, and paste it into Nisus Writer, then show invisibles, I see carriage return characters: ¶. In BBEdit I see ¬ , which its manual says is a “line break.”

So, is the clipboard converting back and forth between returns and line feeds?

The more recent Mac OS’s use line feeds in the clipboard instead of returns. This has caused many things to have to be adjusted from Panorama 6 when using the clipboard in Panorama X. I don’t think Panorama 6 used the standard Mac clipboard so it stayed with returns even when the Mac OS changed to line feeds. Note that most Panorama X functions treat line feeds and returns the same so either one will work without any changes.

Thank you Gary, I thought I was going crazy!

The full story is that Panorama 6 was a “Carbon” application. The Carbon APIs were based on the old Mac OS 9 APIs, which used carriage returns exclusively (including on the clipboard). The Carbon APIs continued to use carriage returns right up until the last version of macOS where Carbon was available (which was 10.14). In fact, on a single computer running 10.14 or earlier you could take the same clipboard contents and get different results depending on whether you were running a Carbon app or a Cocoa App. Yes, very confusing.

Whenever I use the clipboard in Panorama X, I will always use the lftocr( function or the crtolf( function to make sure that there is no doubt about what results I will get.