Do you find this script useful?
Yes
No
Comments?
Write Report to File and Inmagic Tagged Format
This script is useful when emulating Inmagic Tagged Format using Write Report to File in Plain Text format when some fields contain carriage returns in the data. It converts each carriage return to a carriage return, angle bracket, so the line will be interpreted properly by Import (rather than causing the record to be rejected).
Script Language: JavaScript For use with:
DB/TextWorks
Requires at least version 4.2
function onRecordOpen()
{
  var i, boxc, newboxc;

  for (i=0; i < Form.boxes.Count ; i++)
  {
    boxc = Form.boxes(i).content;
    newboxc = boxc.replace(/\r/g,"\r> ");
    Form.boxes(i).content = newboxc;
  }
}
Notes: In order for this script to work, you must assign script names only to those boxes for which you want the change to occur. This script assumes that the boxes which contain carriage returns contain only a single entry. (If the field contains repeating entries, you'd need to set Paragraph Formatting to No Added Paragraph Breaks, use distinctive Separator Text, and convert that Separator Text to carriage return, semicolon, using a similar for loop after the one above.) \r represents a carriage return. The /g means "global" (i.e., do the search and replace on all carriage returns in the field). This script works when you use Write Report to File>Plain Text; the > also appear for Print and Display. The > do not appear in the Report window, which uses \n (line feed) in place of \r.
Submitted by Inmagic Staff on 5/4/2001

Powered by DB/Text WebPublisher, from Inmagic WebPublisher PRO