Skip to main content
Version: 2.3

Create and modify data


  1. Object are first created locally.
  2. Object can then be persisted in Olympe Database.
  3. Properties values can be updated.
  4. Relations can be created between objects.
  5. Data operations can be (optionally) grouped into a Transaction. create_datas

There are other actions to create/modify data:

  • Delete Object
  • Detach All Relations
  • Detach Relation
  • ...

Best practices

Create Constructors: Actions to create Objects (e.g. Create Note) with inputs for attributes (content, summary, …). Constructors call to “Persist” Action.

Create Getters: Functions to get all properties of an Object (e.g. Note’s Attributes) with the object as input (the note) and attributes as outputs (content, summary, …).

Create Setters: Actions to update an Object ( e.g. Set Note’s Content) with the object (the note) and the attribute value (content) as inputs.

Exercise 10 – Notes Constructor and getter

The goal of this exercise is to define a reusable action which creates a new Note (aka a Note constructor).

  1. Go to Folder Data.
  2. Open Notes Data Model.
  3. On Note model, click on the 3 dots icon to open the contextual menu.
  4. Select Generate helper bricks and forms.
  5. Select folder Data and click on Save to Data button.
  6. Select Getter and Constructor.
  7. Below constructor deselect property Category (see screenshot below).
  8. Click on Continue.
  9. Once the bricks are generated, click on close.
  10. Go back to Folder Data => Bricks named Create note and Get Note's attributes were generated. exercise_10_result

Exercise 11 – New Note screen

The goal of this exercise is to define a screen which creates a new note. exercise_11_result

  1. Go to Screen “New Note”
  2. Rename Event “New Header On left button click” to “To home screen” (=> Spec & Doc editor)
  3. Add a Text Field named “Summary Field”
    • Placeholder text = “Summary”
  4. Add a Text Field named “Content Field”
    • Placeholder text = “Content”
  5. Add a Button named “Create Button”
    • Text = “Create”
  6. Group these three components:
    • Group position = Center
  7. Click on "Edit" button (on the group) to edit group layout properties (1st tab):
    • Layout = Vertical
    • Horizontal Align = Center
    • Spacing = 20
    • Children Width = 300
  8. Add an Action triggered by “Create Button” on click event which:
    • Create a new note from values from “Summary Field” and “Content Field”
    • Dispatch the event “To home screen”

This is how the action should look: exercise_11_action