PhixFlow Help

4 Actions – updates, inserts and deletes

Create action to update records

By the end of this section you will be able to:

  • Create actions on streams
  • Add an action to a view
  • Update a selected record with an action
  • Create an action that requests values from users

Set a fixed value on records

  • Open the model Dashboards and Forms 11-13. Actions to update, insert, delete
  • Find the stream Wisteria Books Return Requests, and open the view Wisteria Books Return Requests – you will see a list of book return requests
  • You will add an action to update records in this view – to record when return requests are refused:
    • In the configuration form for the stream Wisteria Books Return Requests, go to the Actions section
    • Press to create a new action
    • Give the action the following configuration:
      • Name: Refuse Return
      • Display Name: Refuse
      • Go to the Update StreamItems section, and set
        • Stream Item Action: Update
      • Press  - Apply
    • Press in the Attributes to Update section
      • In the Stream Action Attribute Details form:
        • Select the Attribute ReturnStatus
        • Set Expression to: "REFUSE"
        • Press 
    • Press  in the main action form to save your changes
  • To associate the action with a view (you will use an existing view on the stream):
    • Open the configuration form for the view Wisteria Books Return Requests
      • Go to the Menu Items section
      • Press - Show Stream Actions
      • Select your action from the drop down list and drag it into the list of actions associated with the view
      • Press   to apply your changes
  • To see the new action button on the view, open the view
  • Test your button: select a record and press the button
    • You will see a message
    • In the bottom right-hand corner, press - Switch to App Mode
  • Try again: select a record and press your button
  • Press  on the view; you will see the ReturnStatus updated
  • Test your button: select a number of records and update the ReturnStatus with your button
  • Return to design mode:
    • In the bottom right-hand corner, press - Switch to Design Mode

Actions to request values from user

You will extend the action you created in the previous exercise to allow users to add to the comment on the record, when they refuse a return.

  • First you need to create a form that will be used to take values from the user – in PhixFlow terms, this is known as a form view:
    • Open the configuration form for the stream Wisteria Books Return Requests
    • Add a grid view:
      • Name: Enter Refusal Comment
      • View Attributes: HandlingComments
      • Go to the Basic Settings section
      • Tick Form View
      • Press  to save your changes
  • Open the configuration form for the action Refuse Return that you created during the previous exercise
  • In the Advanced section, set Form View to Enter Refusal Comment
  • Go to the Attributes to Update section
  • Add an additional attribute:
    • Press  - Show Stream Attributes
    • Drag in the attribute HandlingComments
    • You will see that this is auto-populated with the expression _prompt.HandlingComments – leave this as it is, since this is the expression you need
    • Press  in the main action form to save your changes

This action is already associated with the view, so to test:

  • Go into app mode
  • Open the view Wisteria Books Return Requests
  • Select a record and press the Refuse button
  • In the form that pops up, enter some text into the HandlingComments field
  • Press  on the view
  • You will see the comment update as well as the status
  • Return to design mode

Create actions to insert new records

By the end of this section you will be able to:

  • Create an action to insert a record
  • You will need to take user input for 2 fields in the new action, so you must create a new form view:
    • In the configuration form for the stream Wisteria Books Return Requests, go to the Views tab
    • Create a grid view Add Return Request
      • Add attributes to the view:
        • CustomerRef
        • BookTitle
      • Tick the Form View flag
      • Press
  • In the configuration form for the stream Wisteria Books Return Requests, go to the Actions section
    • Press to create a new action
    • Give the action the following configuration:
      • Name: New Return Request
      • Display Name: New Return
      • Form View: Add Return Request
    • Go to the Update StreamItems section, and set
      • Stream Item Action: Insert
    • Press 
    • Press - Show Stream Attributes
    • Drag in attributes:
      • CustomerRef
      • BookTitle
      • ReturnStatus
    • Set attribute expressions:
      • (Accept the default expressions for CustomerRef and BookTitle, since we will take these values from the user in the form view)
      • Update the expression for ReturnStatus to: "New"
    • Press
  • To associate the new action with the view:
    • Open the configuration form for the view Wisteria Books Return Requests
      • Go to the Menu Items section
      • Press
      • Select the new action from the drop down list and drag it into the list of actions associated with the view
      • Press to apply your changes
  • To see the new action button on the view, open the view (if you already have it open, close it first)
  • Test your button: press the new button, complete the details in the form view and press
  • Press  on the view
  • You will see a new row added

Create action to delete records

By the end of this section you will be able to:

  • Create an action to delete a record
  • In the configuration form for the stream Wisteria Books Return Requests, go to the Actions section
    • Press to create a new action
    • Give the action the following configuration:
      • Name: Delete Return Request
      • Display Name: Delete Return
    • Go to the Update StreamItems section, and set
      • Stream Item Action: Delete
    • Press
  • To associate the new action with the view:
    • Open the configuration form for the view Wisteria Books Return Requests
      • Go to the Menu Items section
      • Press
      • Select the new action from the drop down list and drag it into the list of actions associated with the view
      • Press to apply your changes
  • To see the new action button on the view, open the view
  • Test your button: select a record, press the new button, and press
  • Press  on the view
  • You will see the row disappear

Please let us know if we could improve this page feedback@phixflow.com