FileMaker 11 PHP and ODBC new line / carriage return

I am connecting to a FileMaker Pro 11 server with an ODBC connection. I am importing some information from the eBay API.

When I get the address from ebay, it comes in two fields address1 and address2. In the FileMaker database, we have only one field for the address. I am trying to separate two addresses with line break or carriage return with PHP, but it never works.

I would try to insert:

"$var1\n$var2" 

and FileMaker will read \ n as plain text. The same goes for \ r. I also tried setting the line with:

 <<<EOF 

also not successful. I also tried the pie character, which I read for line breaks, but it doesn't work that way.

So basically .. how can I insert a line break that filemaker will understand with php pdo and odbc?

+4
source share
4 answers

I did some testing and found that even if I did something like $var1 . ord( 10 ) . $var2 $var1 . ord( 10 ) . $var2 $var1 . ord( 10 ) . $var2 , it did not work correctly. I did a double check, and the carriage return to the field when it was entered from the FileMaker client is ASCII char 10 ( \n ). So, here is how I decided it.

I edited the entry to insert '12<br>34' . Then I set the field definition in FileMaker for the field that I set to automatically enter the calculation. My field was called TestField , so my calculation turned out to be Substitute( TestField; "<br>"; ΒΆ ) . Make sure you clear the Do not replace existing value check box. As soon as I did this, editing the field with PHP, using '12<br>34' , as a line placed in the carriage returned between 12 and 34 .

+1
source

Go to this page on google if you have the same problem. I did not want to try to use the auto-enter cal parameter, so it only started with php ...

  $var1 . char( 13 ) . $var2 

Also, when pulling a value from a FileMaker field with a carriage return, you need to be careful when you put it in a variable and back into FileMaker. For instance:

To pull it into a php variable:

  $variable = nl2br($record->getField("field1")); 

and return it to FileMaker:

  $record->setField('field1',str_replace('<br />',chr(13),$variable)); 

Hello

+1
source

The gap must be in its own double quote, for example:

 $var1 . "\n" . $var2 

or

 'var1' . "\n" . 'var2' 
+1
source

There was a problem with Filemaker and Java JDBC in this issue. Here is a solution that may help others.

 Character ch = new Character('\n'); String dataForFM = "Field Data Here" + ch.toString() + "More Field Data Here"; 
+1
source

Source: https://habr.com/ru/post/1347788/


All Articles