Newbies drebbin Posted May 12, 2008 Newbies Posted May 12, 2008 (edited) Hi all This is bound to be helpful for a lot of people... when it works. I have a product database and would like to generate the RSS code for each automatically and put into on field, but can't work out the repeating part. The following is on a List All Products page layout. Not sure if this is best, maybe a portal would be better. Maybe it's all possible within a calculation field not a script. I have a calculation field that does the top and bottom part of the RSS code... "<?xml version='1.0' ?>¶¶¶Title here¶Description here.¶http://www.domain.co.uk¶¶http://www.domain.co.uk/images/logo.gif¶Title here¶http://www.domain.co.uk¶¶" // BEGIN REPEAT PRODUCTS & RSS Code // END REPEAT PRODUCTS & "¶" A script via a button that does the looping and puts the result into a text field (RSS Code)... but it only puts one product in the field. Freeze Window Go to Record/Request/Page [First] Loop Set Field [Products::RSS code; " Go to Record/Request/Page/ [Next; Exit after last] End Loop How can I get it to repeat the code and record values for each record and list them in the text field? [color:red]*This is the calculation for the products, within the script. This part needs to loop/repeat for each product/record... "" </p><p> </p><p> & Products::Brand & ": " & Products::Product Name & "" & Products:<img src='https://fmforums.com/uploads/default_wink.png' alt=';)'> Product URL & "¶Product Code: " & Products::Product Code & "</p><p> In Stock: " & Products::Stock & "</p><p> Price: �" & Products::LIVE Price & "</p><p> </p><ul>" <br> <br> // Change special characters into HTML code for the 'Product Features'<br> & Substitute ( Substitute ( Substitute ( Substitute ( Substitute ( Substitute ( Substitute ( Substitute ( Products::Product Features; "&" ; "&" ) ; "®" ; "�" ) ; "°" ; "�" ) ; "º" ; "�" ) ; "£" ; "�" ) ; "• " ; "<br><li>" ) ; "¶" ; "" ) ; "" ; "<br> </li></ul><p></p><p> </p><ul>" ) <br> <br> & "<br></ul><p>" & "</p><p> " </p><p> </p><p> // Image code</p><p> & "<img src='http://www.domain.co.uk/images/uploads/'>" & "¶" Thanks in advance D Edited May 12, 2008 by Guest
Fitch Posted May 12, 2008 Posted May 12, 2008 Modify the Set Field step like so: Set Field [Products::RSS code; Products::RSS code [color:red]& ¶ & (your code here)]
Newbies drebbin Posted May 13, 2008 Author Newbies Posted May 13, 2008 (edited) Thanks for the quick response. The result though, is just one record still. It's starting at the top of the List All Products layout, working its way down the list, but overwriting each time with the last record (bottom of list) as the final result. If I run the script again it ends up with two of the last record, and so on. Freeze Window Go to Record/Request/Page [First] Loop Set Field [Products::RSS code; Products::RSS code & ¶ & " Go to Record/Request/Page/ [Next; Exit after last] End Loop Edited May 13, 2008 by Guest
Fitch Posted May 13, 2008 Posted May 13, 2008 First of all, this line: Set Field [Products::RSS code; Products::RSS code & ¶ & (your code here)] Should actually be: Set Field [Products::RSS code; Products::Product Features & ¶ & (your code here)] I.e. "RSS code" is the field that is aggregating the records, and "Product Features" is the source field. Second of all, RSS code must be a global field for this to work. Alternately, you could aggregate into a variable and then set that into a field at the end. Just for fun, another way to loop through records: Set Variable[$i;0] Set Field [Products::RSS code; "" ] // GLOBAL FIELD Loop Exit Loop If[ $i > Get( FoundCount ) ] Set Variable[$i;$i+1] Set Field [Products::RSS code; GetNthRecord( Products::Product Features ; $i ) & ¶ & "etc" End Loop
comment Posted May 13, 2008 Posted May 13, 2008 Why don't you use export instead? RSS is just a form of XML - using an appropriate XSLT stylesheet, you could export your data directly to RSS. See: http://www.filemaker.com/products/technologies/xslt_library.html http://edoshin.skeletonkey.com/2006/05/modular_xslt_pa.html
Recommended Posts
This topic is 6039 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