# Default Value based on Calculation Field

**URL:** <https://forum.getodk.org/t/default-value-based-on-calculation-field/17045>\
**Category:** Support\
**Created:** [January 4, 2019, 7:52am UTC](https://forum.getodk.org/t/default-value-based-on-calculation-field/17045 "2019-01-04T07:52:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hoang\_Quang\_Tuyen](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/hoang_quang_tuyen/32/5619_2.png) [@Hoang\_Quang\_Tuyen](https://forum.getodk.org/u/Hoang_Quang_Tuyen)\
**Post date:** [January 4, 2019, 7:52am UTC](https://forum.getodk.org/t/default-value-based-on-calculation-field/17045/1 "2019-01-04T07:52:10Z")

</div>

Hi ,

is it possible to a Integer Field set as default value a previous  
calculated field

type name label  
default

calculate selectedtypea TypeA integer typeb CatB  
int($(selectedtypea))

if i use an integer as a default value works fine, but when i use a  
previous calculated field then pass the conversion to XLSForm but nothing  
displays in Collect...

Thanks  
Panos

---

<div class="post-metadata">

**Author:** ![Xiphware](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/xiphware/32/2587_2.png) [@Xiphware](https://forum.getodk.org/u/Xiphware)\
**Post date:** [January 4, 2019, 8:24am UTC](https://forum.getodk.org/t/default-value-based-on-calculation-field/17045/2 "2019-01-04T08:24:54Z")

</div>

You cant specify a calculation in a default, only a literal value. But you can accomplish the equivalent by adding an additional control for your result to display which takes the user's input value if there is one, otherwise it equals the result of your calculation if no value has been entered yet. Try this:

[calc\_default.xls](https://getodk.b-cdn.net/uploads/default/original/2X/c/c5d0fa157ac7c81f5fce255e54f4d696b4ff5138.xls) (5.5 KB)
