<get-or-create> get an object from the database, or create it if it doesn't exist.

name
get-or-create
xml namespace
http://moyaproject.com/db

Get an object from the db if it exists, create it if it doesn't.

If the object is created, the code in the enclosed block is executed.

Example

<db:get-or-create model="#Permission" let:name="'admin'"
    let:description="'User may perform administration tasks'">
    <echo>New permission was created.
</db:get-or-create>
attributes
name purpose type required? default choices
created Destination to store created flag index No
db Database name text No "_default"
filter Filter expression database expression No
forupdate Issue a select FOR UPDATE? boolean No no
from Application application reference No
initial Object with initial values expression No None
model Model element reference text Yes
inherited attributes
name purpose type required? default choices
dst Destination reference No
if Conditional expression expression No yes
value Value expression No None