# Calculation Field

**URL:** <https://forum.servoy.com/t/calculation-field/1706>\
**Category:** Classic Servoy\
**Created:** [April 14, 2004, 5:38pm UTC](https://forum.servoy.com/t/calculation-field/1706 "2004-04-14T17:38:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebrandt](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@ebrandt](https://forum.servoy.com/u/ebrandt)\
**Post date:** [April 14, 2004, 5:38pm UTC](https://forum.servoy.com/t/calculation-field/1706/1 "2004-04-14T17:38:38Z")

</div>

I am trying to create a calculation field called orderstatus.

I have tried using the if statement. I want the order status result to be “Incomplete” if the “CompletionDate” field is null. I am sure I am having a syntax problem or there may be an issue with the date field.

Here is the calculation method I tried, the result being text:

if (datecompleted = ^)  
{  
return “Incomplete”;  
}

Please tell me what I am doing wrong, I am use to the old case statement in FM, trying to adjust to java.

Thanks,  
Erich

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [April 14, 2004, 5:52pm UTC](https://forum.servoy.com/t/calculation-field/1706/2 "2004-04-14T17:52:16Z")

</div>

Try this:

```auto
if (datecompleted == null) 
{ 
return "Incomplete"; 
}

```

you can do also this:

```auto
if (!datecompleted) 
{ 
return "Incomplete"; 
}

```

Now it returns “Incomplete”, if the field is empty or null!  
Hope this helps

---

<div class="post-metadata">

**Author:** ![ebrandt](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@ebrandt](https://forum.servoy.com/u/ebrandt)\
**Post date:** [April 14, 2004, 6:18pm UTC](https://forum.servoy.com/t/calculation-field/1706/3 "2004-04-14T18:18:44Z")

</div>

Wahlaaa, thank you. I was missing the “==”

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [April 14, 2004, 6:21pm UTC](https://forum.servoy.com/t/calculation-field/1706/4 "2004-04-14T18:21:47Z")

</div>

Exactly!

If you want to set a field, you must use: =

for example: field2 = “Hello”

If you want to use it in a if-statement, you must use: ==

for example: if(field == "Hello) {blablaba}

Servoy is just a learning-curve. Once the Servoy-virus had hit you, you go sky-high! ![:D]( "Very Happy")
