The title says it all.
We have a FileMaker file that is the backend of a Web App made with Xojo. This Web App is used by the customers to create support tickets. These customers may access the Web App from either Windows or MacOS. On the. other side, the support people will work on these tickets mainly on MacOS but that could be on Windows.
The text fields are different whether they are created on a Mac or Windows computer because Windows and Macs do not use the same EOL sequence: Windows is char(13) & char(10) and Mac is char(10). Displaying the text on FileMaker side is always right because FileMaker adapts by itself to the EOL. But on the Xojo side, I need to use the proper EOL to display data.
The work is a little bit more complicated because the connector used, XFM, for obscure reasons strips the EOL sequence when reading form FileMaker. To go around that issue, in FileMaker I have added a calculation field that encode the EOL character(s) by doing a substitution: whatever is the EOL sequence, I replace it by "¬", and that is the calculation field I use in Xojo, where I replace "¬" by the proper sequence depending on the OS.
Sorry for the long introduction. My calculation does not work right. To understand why, I recreated it in a watch expression in the DataViewer:
Let ( [ $$Pos = Position ( COMMUNICATION::Texte ; Char(13) & Char(10) ; 1 ; 1 ); $$EOL = If ( $$Pos > 0 ; Char(13) & Char(10); Char(10) ); $$EOL_2 = "[" & $$EOL_2n & "]" ]; Substitute ( COMMUNICATION::Texte ; $$EOL ; "¬" ) )
Pretty simple, hey ! But that does not always work. When EOL is Char(13) & Char(10), it's Ok. But when EOL is Char(10), it works only sometimes. When it fails, EOL is set by the if to "", thus there are no "¬" in the calculated field and in the Web App I get the text on a single line.
To debug I copy the plain text to BBEdit and asks to get a HEX dump. In that dump, I see the proper EOL:
But since $$EOL is empty, the calculation field is the same as the plain field.
What's wrong in the calculation ? Can you please bring some light ?
Thanks a lot !