Boot Posted May 25, 2006 Posted May 25, 2006 I am hoping to take a found set of images in container fields and generate the guts of a simple web page in a calculation field using repeating segments of code like the one below. I already have the filename isolated in a calculation field, and have posted another question in this forum about isolating the pixel dimensions too (though dimensions are not essential). The repeating code segment looks like this: filename Contents of a description text field The above should be relatively simple to generate with a calculation, but the difficulty for me is how to get it to loop through a found set and add each repetition into the one text field or text file so I can copy and paste it into an html template file. In other words, how to wind up with the following all in the one place: pineapple.jpg A pineapple growing in a Fiji plantation guava.jpg Guava fruit, rich in vitamin C ....etc.... Any help hugely appreciated.
Boot Posted May 27, 2006 Author Posted May 27, 2006 No responses so far, so maybe Filemaker is unable to concatenate data from several records into the one place. I'm surprised. Maybe I can do it by sending a system event to a Windows command-line utility that will concatenate or splice text from a looping Filemaker script into a text file. It's got to be possible.
comment Posted May 27, 2006 Posted May 27, 2006 It's actually quite simple. You need a global text field to concatenate the result. The script would be something like this: Go to Layout [ "YourLayout" (YourTable) ] Show All Records Sort Records [ Restore; No dialog ] Go to Record/Request/Page [ First ] # Set Field [ Globals::gExport; <<< your preamble calc >>> ] # Loop Set Field [ Globals::gExport; Globals::gExport & <<< your repeating calc >>> & ¶ ] Go to Record/Request/Page [ Next; Exit after last ] End Loop # Set Field [ Globals::gExport; Globals::gExport & <<< your postamble calc >>> ] # # Export Field Contents [ Globals::gExport; "file:../somefile.html" ] # Go to Layout [ original layout ] --- Another option is to use XML export, with XML-to-HTML stylesheet. It's a bit more complex - see the XML example file in the documentation.
Boot Posted May 28, 2006 Author Posted May 28, 2006 Wow, fantastic. Thanks heaps for this -- it's going to save me hours of laborious work. I can't believe it's so easy. I'm working on implementing it now, and it looks good so far. For the sake of anyone else reading in future, I've had to create a global field containing a double quote to get the formulas to work correctly with all the quotes required for html. So, one of my calc lines looks like this: "
Recommended Posts
This topic is 6816 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 accountSign in
Already have an account? Sign in here.
Sign In Now