Reformatting what you have to make it easier to read:
If [this:: Start Content <> ""]
Set field [this::gTempText; Middle ( this::gTempText;
Position(this::gTempText; this::Start Content; 1; 1) + Length(this::Start Content );
If [this::End Content <> ""]
Set Field [this::gTempText; Left(this::gTempText; Position( this::gTempText ; this::End Content; 1; 1 ) -1 )]
This looks correct. When I copy and paste the Middle function into the data viewer and use Let to assign values to gTempText and Start Content (Subbing variables for the field names) it and the left function work. I did have to change some colons to semi-colons however. (shown in red above).
Once I changed the colons into semi-colons, the expressions evaluated correctly.
What results are you actually getting when this fails to work for you?
I'm building quite a complicated script with many steps. I want to download the source code of a web page, clean it up and then parse out the bits that I need. The first step in the script that is giving me difficulties is the following:
Set Field [this::gTempText; this::Child Source Code]
This step puts the source code in the gTempText field. But afterwards when I run the rest of the steps the computer labours for about a minute but the gTempText field remains the same.
I was just wondering, actually, if I really need to clean up the text of this very long source code at all? It makes it easier to parse the text but it take my computer a full minute or more to process. Why does it take so long? I have 4MB of RAM on my computer.
Is it possible to parse a source code with all of the spaces and html tags etc. still there?
Your code is correct as far as I can tell from here. Thus, you'll need to check other details. How much data are you putting in gTempText? Is it a field of type text or number? Is it indexed? As a global field--what is usually meant by the g naming convention it won't be indexed, so make sure that global storage is specified.
Text fields in FileMaker can store truly massive amounts of data, but there could be a delay if indexing is turned on and you are setting this field to a really large block of text. This should not be an issue if the field is global, but if not it would explain the delay.
If you Have FileMaker Advanced, I suggest using the debugger and data viewer to monitor your script and this field step by step. If you do not, you can add some show custom dialog steps that display the contents of this field or at least a portion of the field to monitor the values in the field.
Make sure that gTempText is a text field with global storage specified.
I checked the field and it has global storage. It is not indexed. I don't have FM Pro advanced on my computer where I am at the moment.
I added a custom dialog step to include the content of the field in the message.
The dialog box comes up blank.
Would you mind taking a look at the clean up result script, which includes the other script steps and tell me why it is so slow and what am I doing wrong?
Here is a link to a copy of the database with just one record in it.
The script is running in the table called 'this'.
Instead of examing your file, try posting your script here.
To post a script to the forum:
- You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here.
- If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)