Calculation Field

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

Try this:

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

you can do also this:

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

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

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

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