InDesign carriage return in FMP Calculation field

15 messages Options
Embed this post
Permalink
Chad Chelius

InDesign carriage return in FMP Calculation field

Reply Threaded More More options
Print post
Permalink
I have a FMP database and I've created a calculation field that  
concatenates multiple fields into one field for export. However I need  
to create carriage returns (hard returns) in specific locations so  
that they appear correctly in the InDesign layout. Does anyone have  
any idea what the character code is for an InDesign hard return?

Chad Chelius
Winfried Huslik

Re: InDesign carriage return in FMP Calculation field

Reply Threaded More More options
Print post
Permalink
Chad,

Normal CRs cannot be exported within a record, no matter how hard you  
try.

Depending on what InDesign eats, you could try

- Export Field Contents, which preserves the CR but exports the text  
as utf-16 encoded.

- put the data into a separate table so that the CR at the end of the  
record will be utilized.

- the by far superior method would be to use XML export where an XSLT  
style sheet does all the formatting. Take a look into the Extras  
folder of you FileMaker Pro Advanced folder.


Winfried
www.fmdiff.com


On 2009-10-11, at 18:51, Chad Chelius wrote:

> I have a FMP database and I've created a calculation field that  
> concatenates multiple fields into one field for export. However I  
> need to create carriage returns (hard returns) in specific locations  
> so that they appear correctly in the InDesign layout. Does anyone  
> have any idea what the character code is for an InDesign hard return?
>
> Chad Chelius
Tim Mansour

Re: InDesign carriage return in FMP Calculation field

Reply Threaded More More options
Print post
Permalink
In reply to this post by Chad Chelius
2009/10/12 Chad Chelius <[hidden email]>:
> Does anyone have any idea what the character code is
> for an InDesign hard return?

Chad I'm assuming you're creating an InDesign Tagged Text file, in
which case you can use the tag

<0x000D>

to insert a carriage return (ie, it specifies the character with
hexadecimal code D which is decimal 13).

--
Tim Mansour <[hidden email]>
Neologica Print & Promotions ABN 63 904 335 408
Certified FileMaker 10 Developer

"The love of one's country is a splendid thing. But why should love
stop at the border?" -- Pablo Casals
Emma Glaisher

Re: InDesign carriage return in FMP Calculation field

Reply Threaded More More options
Print post
Permalink
In reply to this post by Chad Chelius
Some javascript/style in this post has been disabled (why?)
I'll have to read Winifred's response, but I've been struggling with this
one for ages, both with Quark and InDesign destinations.

My solution, which will only work on a Mac platform, is to use Applescript
to change the characters in the exported file. This means replacing ASCII
character 11 with ASCII character 13.

I get the users to run it when importing the file into ID or Quark, rather
than using 'get text' or 'import'. This is because the actual database users
are on PCs. If your solution is entirely Mac-based, you could make the
script a seamless part of the export routine.

Below is the script I use to clean the text:

tell application "Finder"
try
set my_file to choose file
open for access (my_file) with write permission
copy (read my_file) to the_text
set eof my_file to 0
set the_text to my replace_chars(the_text, ASCII character 11, ASCII
character 13)
write the_text to my_file
close access my_file
on error
close access my_file
end try
end tell


on replace_chars(this_text, search_string, replacement_string)
set item_count to 10
repeat until item_count = 1
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set item_count to length of item_list
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
end repeat
return this_text
end replace_chars

tell document 1 of application "Adobe InDesign CS3"
make new text frame at beginning with properties {geometric bounds:{0,
-60, 300, -4}}
place my_file on text frame 1
end tell




On 11/10/09 17:51, "Chad Chelius" <[hidden email]> wrote:

> I have a FMP database and I've created a calculation field that
> concatenates multiple fields into one field for export. However I need
> to create carriage returns (hard returns) in specific locations so
> that they appear correctly in the InDesign layout. Does anyone have
> any idea what the character code is for an InDesign hard return?
>
> Chad Chelius
>
> --------------------------------
> Inbound email scanned by Mimecast.
> --------------------------------
>


Emma Glaisher
Artworker and Database Development
Fourninety Limited

Tel: 0113 238 2447
[hidden email]
http://www.fourninety.com/

Fourninety Limited, a member company of the Media Square plc group. Registered in England No. 3737606. Registered address Clarence Mill, Clarence Road, Bollington, Cheshire. SK10 5JZ

Confidentiality Notice: The information in this document and any attachments are confidential. It is intended only for the use of the named recipient. If you are not the intended recipient please notify us immediately and delete this document. The contents on this document must not be disclosed to any other person nor may any copies be taken. The views of the author may not represent the views of the Company.

Security Warning: This e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium. All liability for any claims arising as a result of using this medium to transmit information by us or to us is excluded to the extent permitted by law.
Emma Glaisher

Re: InDesign carriage return in FMP Calculation field

Reply Threaded More More options
Print post
Permalink
In reply to this post by Tim Mansour
Some javascript/style in this post has been disabled (why?)
Unfortunately in my experience, using these tags stops InDesign from
recognising the file as tagged text.

If you've made it work, please tell me more!

I've found documentation very unhelpful on special characters, so if
anyone's interested:

tab = <0x0008>
right tab = <0x0008>
indent here = <0x0007>

!


On 11/10/09 21:26, "Tim Mansour" <[hidden email]> wrote:

> 2009/10/12 Chad Chelius <[hidden email]>:
>> Does anyone have any idea what the character code is
>> for an InDesign hard return?
>
> Chad I'm assuming you're creating an InDesign Tagged Text file, in
> which case you can use the tag
>
> <0x000D>
>
> to insert a carriage return (ie, it specifies the character with
> hexadecimal code D which is decimal 13).


Emma Glaisher
Artworker and Database Development
Fourninety Limited

Tel: 0113 238 2447
[hidden email]
http://www.fourninety.com/

Fourninety Limited, a member company of the Media Square plc group. Registered in England No. 3737606. Registered address Clarence Mill, Clarence Road, Bollington, Cheshire. SK10 5JZ

Confidentiality Notice: The information in this document and any attachments are confidential. It is intended only for the use of the named recipient. If you are not the intended recipient please notify us immediately and delete this document. The contents on this document must not be disclosed to any other person nor may any copies be taken. The views of the author may not represent the views of the Company.

Security Warning: This e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium. All liability for any claims arising as a result of using this medium to transmit information by us or to us is excluded to the extent permitted by law.
Tim Mansour

Re: InDesign carriage return in FMP Calculation field

Reply Threaded More More options
Print post
Permalink
2009/10/12 Emma Glaisher <[hidden email]>

> Unfortunately in my experience, using these tags stops InDesign from
> recognising the file as tagged text.
>
> If you've made it work, please tell me more!

I suspect the problem you describe is the result of two apparently
conflicting requirements:

1. InDesign tagged files require the start tag, eg, <ASCII-MAC> be the
entire first paragraph.

2. We want to convert FileMaker's internal representation of the
carriage return into <0x000D>.

So if we assemble all the export text in a field, then convert FM's
returns to the ID tag, we no longer have the ID start tag on its own
line, and upon import ID doesn't recognise the file as tagged text.

A workaround is to export 2 records: the first contains ONLY the
InDesign Tagged Text start tag, and the second record contains the
rest of the export text compiled from your database, with returns and
tabs substituted for ID tags. You might choose to create a special
Export table to hold these two records. Doing it this way means the
return that FM inserts between records in the export file is retained,
and hence the ID start tag line is maintained.

I've uploaded a (very basic) example to my iDisk:

http://files.me.com/tlm/69p0zx

--
Tim Mansour <[hidden email]>
Neologica Print & Promotions ABN 63 904 335 408
Certified FileMaker 10 Developer

"Opportunity is missed by most people because it is dressed in
overalls and looks like work." -- Thomas Edison
Emma Glaisher

Re: InDesign carriage return in FMP Calculation field

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Work web won't let me onto your link! But I will grab it from home tonight.
Thanks, I will have a look at it.

Meanwhile I think I see where you're coming from. At present my export
fields are calculated for each product, so it's something like ProductName,
return, (ID tags) ProductDescription, return, (ID Tags) Was price (ID Tags)
Now price

There is also built in to the calculation a line which says: ' if this is
the first found record, put the header field followed by a return at the
top' - the header field includes the <ASCII-Mac> line and all the paragraph
and character style definition for InDesign. So I think all the returns in
that would need to be 'proper' returns, which means each line would have to
be a separate field, if I'm understanding you correctly.

Then all the export fields would need to be concatenated into one, and for
the life of me I can't think how to do that. I'm probably missing something
very obvious. I mean I need to put 'export field' from each found record
into a single record and export that, along with the various 'header
fields'. Of course those would all need to be in a separate table, which is
fine. But how to combine them??

(I'm always exporting quite a small subset of the entire database, only the
products which occur on a given page of a given catalogue)

If the above makes any sense at all, which I doubt, I hope you can point me
to the obvious solution!


> I suspect the problem you describe is the result of two apparently
> conflicting requirements:
>
> 1. InDesign tagged files require the start tag, eg, <ASCII-MAC> be the
> entire first paragraph.
>
> 2. We want to convert FileMaker's internal representation of the
> carriage return into <0x000D>.
>
> So if we assemble all the export text in a field, then convert FM's
> returns to the ID tag, we no longer have the ID start tag on its own
> line, and upon import ID doesn't recognise the file as tagged text.
>
> A workaround is to export 2 records: the first contains ONLY the
> InDesign Tagged Text start tag, and the second record contains the
> rest of the export text compiled from your database, with returns and
> tabs substituted for ID tags. You might choose to create a special
> Export table to hold these two records. Doing it this way means the
> return that FM inserts between records in the export file is retained,
> and hence the ID start tag line is maintained.
>
> I've uploaded a (very basic) example to my iDisk:
>
> http://files.me.com/tlm/69p0zx
>
> --
> Tim Mansour <[hidden email]>
> Neologica Print & Promotions ABN 63 904 335 408
> Certified FileMaker 10 Developer
>
> "Opportunity is missed by most people because it is dressed in
> overalls and looks like work." -- Thomas Edison
>
> --------------------------------
> Inbound email scanned by Mimecast.
> --------------------------------
>


Emma Glaisher
Artworker and Database Development
Fourninety Limited

Tel: 0113 238 2447
[hidden email]
http://www.fourninety.com/

Fourninety Limited, a member company of the Media Square plc group. Registered in England No. 3737606. Registered address Clarence Mill, Clarence Road, Bollington, Cheshire. SK10 5JZ

Confidentiality Notice: The information in this document and any attachments are confidential. It is intended only for the use of the named recipient. If you are not the intended recipient please notify us immediately and delete this document. The contents on this document must not be disclosed to any other person nor may any copies be taken. The views of the author may not represent the views of the Company.

Security Warning: This e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium. All liability for any claims arising as a result of using this medium to transmit information by us or to us is excluded to the extent permitted by law.
Steve B. Gerow

Re: InDesign carriage return in FMP Calculation field

Reply Threaded More More options
Print post
Permalink
In reply to this post by Chad Chelius
Emma,
It may be possible to use the 'char' and 'code' text functions in fm10 to do what you want.


--
Steve Gerow
FileMaker 9/8/7 Certified Developer

President
Abrazos Data Consulting, Inc.
Pasadena, California
Member FileMaker Bus. Alliance
Tim Mansour

Re: InDesign carriage return in FMP Calculation field

Reply Threaded More More options
Print post
Permalink
In reply to this post by Emma Glaisher
2009/10/12 Emma Glaisher <[hidden email]>
>
> At present my export
> fields are calculated for each product, so it's something like ProductName,
> return, (ID tags) ProductDescription, return, (ID Tags) Was price (ID Tags)
> Now price

Okay, so how about something along the lines of this psuedo-coded script:

Set Variable [ $buffer; "" ]
Go To Layout [ Products ]
Find Records [ desired criteria ]
Sort Records [ desired sort order ]
Go To Record [ First ]
Loop
  Set Variable [ $buffer; $buffer &
    Products::ProductName & "¶" &
    Products::ProductDescription & "¶" &
    Products::Was Price & "¶" &
    Products::Now Price & "¶"
  Go To Record [ Exit After Last; Next ]
End Loop
Go To Layout [ Export ]
Show All Records
Delete All Records
New Record
Set Field [ Export::Text; "<ASCII-MAC>" ]
New Record
Set Field [ Export::Text; Substitute ( $buffer;
  [ "¶"; "<0x000D>" ]; /* return */
  [ " "; "<0x0009>" ] ) /* tab */
Export Records [ Export::Text field to indesign.txt (tab-delimited) ]

There are other things you'd probably be adding (style definitions
etc) but hopefully this is enough to illustrate the point. The
critical thing in this method is keeping the InDesign file header
"<ASCII-MAC>" in one paragraph at the top of the output file.

Another approach would be to export each of the product records
separately: you would need to create a dummy product that sorts first
and which contains the InDesign header, which you could delete after
export. In each record a calculated field could apply your InDesign
tags, and I'd put the calculation into a global field and use the
Evaluate function so the output can be managed on a setup screen
somewhere.

--
Tim Mansour <[hidden email]>
Neologica Print & Promotions ABN 63 904 335 408
Certified FileMaker 10 Developer
Mobile 0405 500 846 : Melbourne in-dial 03 9012 7441
Winfried Huslik

Re: InDesign carriage return in FMP Calculation field

Reply Threaded More More options
Print post
Permalink
In reply to this post by Steve B. Gerow
Steve,

No it isn't! As I said in my post: no matter how hard you try...


Winfried



On 2009-10-12, at 20:27, Steve B. Gerow wrote:

> Emma,
> It may be possible to use the 'char' and 'code' text functions in  
> fm10 to do what you want.
>
>
> --
> Steve Gerow
> FileMaker 9/8/7 Certified Developer
Steve B. Gerow

Re: InDesign carriage return in FMP Calculation field

Reply Threaded More More options
Print post
Permalink
In reply to this post by Chad Chelius
Has anyone tried this?:
1) export the records to a tab-sep text file
2) import the text file into a single global field
3) use the Substitute function with Char/Code functions to set the para returns in the text in the global

Also one of the Troi plugins is supposed to handle this.

--
Steve Gerow
FileMaker 9/8/7 Certified Developer

President
Abrazos Data Consulting, Inc.
Pasadena, California
Member FileMaker Bus. Alliance


>  -------Original Message-------
>  From: Winfried Huslik <[hidden email]>
>  Subject: Re: InDesign carriage return in FMP Calculation field
>  Sent: Oct 12 '09 23:35
>  
>  Steve,
>  
>  No it isn't! As I said in my post: no matter how hard you try...
>  
>  
>  Winfried
>  
>  
>  
>  On 2009-10-12, at 20:27, Steve B. Gerow wrote:
>  
>  > Emma,
>  > It may be possible to use the 'char' and 'code' text functions in  
>  > fm10 to do what you want.
>  >
>  >
>  > --
>  > Steve Gerow
>  > FileMaker 9/8/7 Certified Developer
>  
Emma Glaisher

Re: InDesign carriage return in FMP Calculation field

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
I quite like that... having a go now!


On 13/10/09 13:41, "Steve B. Gerow" <[hidden email]> wrote:

> Has anyone tried this?:
> 1) export the records to a tab-sep text file
> 2) import the text file into a single global field
> 3) use the Substitute function with Char/Code functions to set the para
> returns in the text in the global
>


Emma Glaisher
Artworker and Database Development
Fourninety Limited

Tel: 0113 238 2447
[hidden email]
http://www.fourninety.com/

Fourninety Limited, a member company of the Media Square plc group. Registered in England No. 3737606. Registered address Clarence Mill, Clarence Road, Bollington, Cheshire. SK10 5JZ

Confidentiality Notice: The information in this document and any attachments are confidential. It is intended only for the use of the named recipient. If you are not the intended recipient please notify us immediately and delete this document. The contents on this document must not be disclosed to any other person nor may any copies be taken. The views of the author may not represent the views of the Company.

Security Warning: This e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium. All liability for any claims arising as a result of using this medium to transmit information by us or to us is excluded to the extent permitted by law.
Emma Glaisher

Re: InDesign carriage return in FMP Calculation field

Reply Threaded More More options
Print post
Permalink
In reply to this post by Steve B. Gerow
Some javascript/style in this post has been disabled (why?)
At stage 2, the imported text created a separate record for each item.
Perhaps I'd be better off copying the text and pasting it into the global
field?

And now I've been broken off to do some 'real' work (ie. what they pay me
for!)...


On 13/10/09 13:41, "Steve B. Gerow" <[hidden email]> wrote:

> Has anyone tried this?:
> 1) export the records to a tab-sep text file
> 2) import the text file into a single global field
> 3) use the Substitute function with Char/Code functions to set the para
> returns in the text in the global
>


Emma Glaisher
Artworker and Database Development
Fourninety Limited

Tel: 0113 238 2447
[hidden email]
http://www.fourninety.com/

Fourninety Limited, a member company of the Media Square plc group. Registered in England No. 3737606. Registered address Clarence Mill, Clarence Road, Bollington, Cheshire. SK10 5JZ

Confidentiality Notice: The information in this document and any attachments are confidential. It is intended only for the use of the named recipient. If you are not the intended recipient please notify us immediately and delete this document. The contents on this document must not be disclosed to any other person nor may any copies be taken. The views of the author may not represent the views of the Company.

Security Warning: This e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium. All liability for any claims arising as a result of using this medium to transmit information by us or to us is excluded to the extent permitted by law.
Emma Glaisher

Re: InDesign carriage return in FMP Calculation field

Reply Threaded More More options
Print post
Permalink
In reply to this post by Steve B. Gerow
Some javascript/style in this post has been disabled (why?)
OK, in my plodding way I have a result!

Create a new table.
2 fields - one text called 'Export Field', one calculation:
Substitute ( Export Field ; "¶" ; "<0x000D>" )

Create record 1, and put
<ASCII-MAC>
(no returns) into it.

Create record 2 and put the rest of the InDesign tags header into it
(probably not necessary if the styles, colours etc already exist in your
destination file). In my case that's a long list but starts:

<Version:5><FeatureSet:InDesign-Roman><ColorTable:=<Black:COLOR:CMYK:Process
:0,0,0,1><c0m100y100k0:COLOR:CMYK:Process:0,1,1,0>>
<DefineCharStyle:HomeDelivery=<Nextstyle:HomeDelivery><cSize:7.000000><cStro
keWeight:0.000000><cTracking:0><cLeading:8.000000><cUnderline:0><cFont:Zapf
Dingbats><cStrikethru:0>>
<DefineCharStyle:POD Price Pence Black=<Nextstyle:POD Price Pence
Black><cSize:11.000000><cBaselineShift:5.000000>>
etc etc!

Create record 3 and paste the old 'export' file, less the header part.

Export this field from these 3 records, and InDesign picks it up perfectly.

Now I need to script the process, but this is the first time I have EVER, in
ID or Quark, been able to use their native import/get text commands to place
my text rather than having to first run a script to substitute correct
returns.

Could be a way forward?

PS Winfried - I have had a peer into the XSML folder, and must confess I am
utterly baffled and a little bit scared!




On 13/10/09 13:41, "Steve B. Gerow" <[hidden email]> wrote:

> Has anyone tried this?:
> 1) export the records to a tab-sep text file
> 2) import the text file into a single global field
> 3) use the Substitute function with Char/Code functions to set the para
> returns in the text in the global
>
> Also one of the Troi plugins is supposed to handle this.


Emma Glaisher
Artworker and Database Development
Fourninety Limited

Tel: 0113 238 2447
[hidden email]
http://www.fourninety.com/

Fourninety Limited, a member company of the Media Square plc group. Registered in England No. 3737606. Registered address Clarence Mill, Clarence Road, Bollington, Cheshire. SK10 5JZ

Confidentiality Notice: The information in this document and any attachments are confidential. It is intended only for the use of the named recipient. If you are not the intended recipient please notify us immediately and delete this document. The contents on this document must not be disclosed to any other person nor may any copies be taken. The views of the author may not represent the views of the Company.

Security Warning: This e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium. All liability for any claims arising as a result of using this medium to transmit information by us or to us is excluded to the extent permitted by law.
Tim Mansour

Re: InDesign carriage return in FMP Calculation field

Reply Threaded More More options
Print post
Permalink
In reply to this post by Steve B. Gerow
2009/10/13 Steve B. Gerow <[hidden email]>:
> Has anyone tried this?:
> 1) export the records to a tab-sep text file
> 2) import the text file into a single global field
> 3) use the Substitute function with Char/Code functions to set the para returns in the text in the global

Steve, that's not going to work as-is for the reasons I've outlined
previously: once you've gathered all the text into a single global
field you've lost the ability to get it out again while keeping the
InDesign header in its own paragraph. I haven't tested but also I
don't know that you'd be saving much time compared with just looping
through the records and assembling the global field with a
calculation.

Emma: given that you're using AppleScript anyway ... the Satimage
scripting addition includes a "change" command that allows you to
search/replace text within a file on disk without having to open the
file. Of course you may not want to install scripting additions on
each client machine...

--
Tim Mansour <[hidden email]>
Neologica Print & Promotions ABN 63 904 335 408
Certified FileMaker 10 Developer

"He who is devoid of the power to forgive is devoid of the power to
love." -- Martin Luther King, Jr