Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Generate RSS code - loop

Featured Replies

  • Newbies

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 by Guest

Modify the Set Field step like so:

Set Field [Products::RSS code; Products::RSS code [color:red]& ¶ & (your code here)]

  • Author
  • Newbies

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 by Guest

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

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

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.