Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Text Functions


goosebriar

Recommended Posts

I currently have a php page that has a textbox in which I paste text which representing multiple records which I have copied off the screen of an old dos program and my php script will separate the records from the one text box.

 

So for example, I would paste the following text:

 

BIO 117 4.0 A- 14456 082

BIO 119 4.0 A- 61238 082

BIO 120 4.0 A+ 78936 082

 

All at once into one textbox and it would make 3 separate records from it.

 

Is there a way to approach this in Filemaker 8? Perhaps one global field and a script to process the field contents into three records? How would I do this? What are some good text functions to separate the text into records?

Link to comment
Share on other sites

I could write a script but I am not sure if you have

 

- script variables

- the GetValue ( ) function

and/or

- the middleValues () function

 

in version 8. memory fails, can you tell me if they are there?

Link to comment
Share on other sites

Yes, I have that, although I'm new at variables in Filemaker.

 

I am about half-way through figuring this out. I made several calculated fields that parsed the text using the middle function. Now I think I will make a script to further parse those fields and make them into new records.

 

Do you have any further suggestions?

Link to comment
Share on other sites

here's a possible script:

 

set variable [ $total ; ValueCount ( Utility::TextToParse )]
set variable [ $ count ; 1 ]
set variable [ $Text ;  Utility::TextToParse ]
go to layout [ TargetLayout (TargetTable) ]
loop
 new record / request
 set field [ TargetTable::Field1 ; leftwords ( GetValue ( $Text ; $count ) ; 1 ]
 set field [ TargetTable::Field2 ; Middlewords ( GetValue ( $Text ; $count ); 2; 1 ) ; 1 ]
 set field [ more parse work as needed ]
 [b][color=Red]commit records / requests[/color][/b]
 set variable [ $count ; $count + 1 ]
 exit loop if [ $count > $total ]
end loop

typed from memory, if you run into problems let me know.

Link to comment
Share on other sites

The getValue function isn't working in the script, although I can get it to work as a calculated field.

 

What I would like is for each line ending in a carriage return to be added as a record.

 

When I do the loop based on valueCount, it makes correct number of records but they are empty.

Link to comment
Share on other sites

Please post your script as you have it now.

PS I have added a commit records script step just now. see above.

Link to comment
Share on other sites

I think I am going to go with just making fields which will calculate using the getValue function instead of doing a looping script. Thanks for your help, though!

Link to comment
Share on other sites

In my script, GetValue is used to extract the nth value of the original field content. This in a loop: the nth run in a loop will pick the nth value and put it in an nth record...

I'm not really sure what you mean by "calculate".

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

Terms of Use