Phone Book Example
def module default {
  def entity Person {
    id: Id,
    name: String,
    phone: String
  }
  read phone, name where true
  write phone, name where true

  def screen directory {
    iterator (row in (from (p in Person) select p)) {
      label "Name: " + row.name; br;
      label "Phone: " + row.phone; br; br
    };
    label "Name: "; textfield name; br;
    label "Phone: "; textfield phone; br;
    button "Add" to addPerson(name, phone)
  }

  def action addPerson(nameIn: String, phoneIn: String): Block { 
    insert {
      name = nameIn,
      phone = phoneIn
    } in Person;
    directory()
  }
}

Back