Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Importing several lines of text into one field?


Per Mattsson

This topic is 7968 days old. Please don't post here. Open a new topic instead.

Recommended Posts

First thing: text fields have a 64,000 character limit, so you won't fit 1MB of text into a single field be it global or not.

One method is to write a simple looping script. First find all the records you want to concatenate and sort them into their appropriate order. (I'll assume that the text is in a field called "Lines" and it goes into a field called "gFull".) Then run this script:

Set Field [gFull, ""]

Go to Record/Request [first]

Loop

Set Field [gFull, gFull & Lines]

Go to Record/Request [exit after last, next]

End Loop

To get your delimiters out use the Substitute() function:

Set Field [gFull, Substitute(gFull, "

Link to comment
Share on other sites

  • Newbies

Hi!

Thanks for replying and the script. I'll check it out.

I think I'll try to make more clear what I want to do.

In the DB each records has one particular field that contains this multiline content - abstracts from a article. There's only one abstract per record. One of these abstracts is someting in size of 1000 to 2000 characters long. So the content in this field (in one of the records) are also 1000 to 2000 characters.

My source file is a plain text file with alot of abtracts, one after the other separated by

Link to comment
Share on other sites


# Import all the text one line per record into the field "RawText"

import[import order: RawText(text)]

show all records

unsort

go to record/request [first]

set field [gTextbuffer,""]

# Loop through the raw text and gather it into global gTextbuffer

loop

if [patterncount(RawText,"*****")]

# Separator found so save the text in a new "formatted" record

# but first save the number of the current raw text record

Set field [gRecordNo, Status(CurrentRecordNumber)]

New Record/Request

Set field [FormattedText, gTextbuffer]

Set field [gTextbuffer, ""]

Set field [RecordType, "Formatted"]

# Now go back to the current raw text record

Go to record [gRecordNo][by field value]

Else

# Not a separator, so add text to buffer

Set field [gTextbuffer, gTextbuffer & "

Link to comment
Share on other sites

This topic is 7968 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.