# Database Functions

**URL:** <https://community.origam.com/t/database-functions/2093>\
**Category:** model reference\
**Created:** [December 31, 2017, 11:00pm UTC](https://community.origam.com/t/database-functions/2093 "2017-12-31T23:00:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://community.origam.com/uploads/default/original/2X/8/8ea6cb18e600b5c43b7097ad12e3b9cb503a925b.png) [@system](https://community.origam.com/u/system)\
**Post date:** [December 31, 2017, 11:00pm UTC](https://community.origam.com/t/database-functions/2093/1 "2017-12-31T23:00:00Z")

</div>

Fields and filters called by a [Function Call Field](https://community.origam.com/t/function-call-field/2160) that are defined with database functions will be retrieved from the database but will not be recalculated, for example if the user changes data in a screen. The fields will be recalculated after changes are saved to the database.

# Custom Defined Database Functions

There are some predefined functions delivered with the root package but you also can define your own database functions by right-clicking on the Functions, selecting New \> Function and providing the following attributes.

The function needs to exist in the database already and has to have the same name as in the model. Don’t forget to provide a [Deployment Script](https://community.origam.com/t/deployment/2109) for your function so it will be successfully deployed to the target database.

You can let Architect create a boilerplate code for your function. Just model the function including the parameters, click on the function and look at the Output window. It will show an SQL to create the function.

| | |
| --- | --- |
| Name | Name of the function exactly as named in the database. |
| DataType | [Data type](https://community.origam.com/t/data-types/2088) of the return value. |
| FunctionType | Always use `Database` |

# Child Elements

> [@Function Parameter](https://community.origam.com/t/function-parameter/2161):
>
> Typically functions require some values to be passed as parameters. To define a parameter, add a Function Parameter element under the function with the following attributes: Name N…
