goosebriar Posted May 22, 2008 Share Posted May 22, 2008 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? Quote Link to comment Share on other sites More sharing options...
Maarten Witberg Posted May 23, 2008 Share Posted May 23, 2008 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? Quote Link to comment Share on other sites More sharing options...
goosebriar Posted May 23, 2008 Author Share Posted May 23, 2008 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? Quote Link to comment Share on other sites More sharing options...
Maarten Witberg Posted May 23, 2008 Share Posted May 23, 2008 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. Quote Link to comment Share on other sites More sharing options...
goosebriar Posted May 23, 2008 Author Share Posted May 23, 2008 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. Quote Link to comment Share on other sites More sharing options...
Maarten Witberg Posted May 23, 2008 Share Posted May 23, 2008 Please post your script as you have it now. PS I have added a commit records script step just now. see above. Quote Link to comment Share on other sites More sharing options...
goosebriar Posted May 23, 2008 Author Share Posted May 23, 2008 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! Quote Link to comment Share on other sites More sharing options...
Maarten Witberg Posted May 23, 2008 Share Posted May 23, 2008 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". Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.