Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Insert excerpt
_Banners
_Banners
nameactionflow
nopaneltrue

Insert excerptXML NodeXML NodenameWholePagenopaneltrue
HTML Comment
hiddentrue

Worked Example

Here is a worked example using an XML file from BBC News (https://feeds.bbci.co.uk/news/technology/rss.xml).

In this example, we are using:  

  • Shop News screen containing a blank grid and a button  - this screen was created using the Multi-tile template
Tip

If you are completing this chapter as part of the Actionflow course and using a training instance, the data and screens have already been pre-loaded into the Actionflow Intermediate Application. For these example, we'll be working on the Shop News screen

Create an RSS Feed using XML Data

In this example, we'll create a table containing BBC News from an XML file.

Image Modified

Table Setup

  1. Create a new 
    Insert excerpt
    _tables
    _tables
    nopaneltrue
     on your 
    Insert excerpt
    _erd
    _erd
    nopaneltrue
     to save the news data to, and ensure it contains the following attributes:
    1. Name: UID
      1. Type: Integer
      2. Expression: _NULL
    2. Name: Title
      1. Type: String
      2. Expression: _NULL
    3. Name: Description
      1. Type: Bigstring
      2. Expression: _NULL
    4. Name: Link
      1. Type: String
      2. Expression: _NULL
    5. Name: Date
      1. Type: Datetime
      2. Expression: _NULL
    6. Name: Source
      1. Type: String
      2. Expression: _NULL

Actionflow Setup 

  1. On the Shop News screen, add an Actionflow on the Start RSS Feed button
  2. Select Click to Connect and choose On Click
  3. Drag a 
    Insert excerpt
    _http
    _http
    nopaneltrue
     action onto the canvas and give it a suitable name - this will be used to retrieve the news from the XML document
  4. Drag the 
    Insert excerpt
    _input
    _input
    nopaneltrue
     connection point node onto the
    Insert excerpt
    _http
    _http
    nopaneltrue
     action
  5. Click on the 
    Insert excerpt
    _http
    _http
    nopaneltrue
     action to open its Properties
    1. HTTP Method: GET
    2. URL: https://feeds.bbci.co.uk/news/technology/rss.xml
  6. Drag a 
    Insert excerpt
    _action_xml
    _action_xml
    nopaneltrue
     action onto the canvas and give it a suitable name - this will be used to convert the XML data into data suitable for PhixFlow to process
  7. Connect the out connector from the 
    Insert excerpt
    _http
    _http
    nopaneltrue
     to the
    Insert excerpt
    _action_xml
    _action_xml
    nopaneltrue
     action
    1. Map across the attribute, body

      Expand
      titleCheckpoint

      Image Modified


XML Action Setup

  1. Click on the 
    Insert excerpt
    _action_xml
    _action_xml
    nopaneltrue
     action to open its Properties and populate the following:
    1. Input Expression: in.body
    2. Path: /rss/channel/item
    3. Output Attributes:

      Code Block
      themeEmacs
      titleName: Title, Type: String
      _result.title


      Code Block
      themeEmacs
      titleName: Description, Type: Bigstring
      _result.description


      Code Block
      themeEmacs
      titleName: Link, Type: String
      _result.link


      Code Block
      themeEmacs
      titleName: ID, Type: String
      _NULL


      Code Block
      themeEmacs
      titleName: Date, Type: Datetime
      do(
      	$dater = replaceAll(_result.pubDate, " GMT", ""),
      	$dater = substring($dater, 6),
      	
      	toDate($dater, "dd MMM yyyy HH:mm:ss")
      )


      Code Block
      themeEmacs
      titleName: Source, Type: String
      _result.^.title


  2. Hover over the XML action and select out
  3. Create a
    Insert excerpt
    _action_save
    _action_save
    nopaneltrue
     action
    1. Primary Table: The News table you created earlier
    2. Map across the XML attributes to their relevant attributes on the Save action

      Expand
      titleHow?

      Image Modified


Screen Setup

  1. Open the Shop News screen
  2. Click on 
    Insert excerpt
    _attributes
    _attributes
    nopaneltrue
     in the toolbar, then select the News table you created earlier
  3. In the Available Attributes selector, select all attributes and drag them onto the screen, then choose to display the data as a 
    Insert excerpt
    _grid
    _grid
    nopaneltrue

Testing

  1. On the Shop News screen,
    Insert excerpt
    _lock
    _lock
    nopaneltrue
     the screen and click the 
    Start RSS Feed button
  2. If the Actionflow is working, the News grid should contain all of the BBC News data


Image Modified