# defined value error

**URL:** <https://forum.servoy.com/t/defined-value-error/2709>\
**Category:** Classic Servoy\
**Created:** [September 15, 2004, 2:12pm UTC](https://forum.servoy.com/t/defined-value-error/2709 "2004-09-15T14:12:21Z")\
**Posts on this page:** 11\
**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:** [September 15, 2004, 2:12pm UTC](https://forum.servoy.com/t/defined-value-error/2709/1 "2004-09-15T14:12:21Z")

</div>

I have a form that runs the following method OnShow.

if(approval\_date)  
{  
elements.BtnPrint.visible = true;  
}  
else  
{  
elements.BtnPrint.visible = false;  
}

I get the following error when the method runs:

“approval\_date” is not defined.

After the error I get the expected result. What does this error mean.

Thanks,  
Erich

---

<div class="post-metadata">

**Author:** ![bcusick](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@bcusick](https://forum.servoy.com/u/bcusick)\
**Post date:** [September 15, 2004, 7:13pm UTC](https://forum.servoy.com/t/defined-value-error/2709/2 "2004-09-15T19:13:49Z")

</div>

You need to say:

if(approval\_date != null)

This is because the approval\_date is an object and you’re not giving it a condition to compare to.

Hope this helps,

Bob Cusick

---

<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:** [September 15, 2004, 7:20pm UTC](https://forum.servoy.com/t/defined-value-error/2709/3 "2004-09-15T19:20:47Z")

</div>

Bob,  
Thats wasnot my understanding because of a prior post

[http://forum.servoy.com/viewtopic.php?t=2643&highlight=](http://forum.servoy.com/viewtopic.php?t=2643&highlight=)

Thans for clearing it up.

---

<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:** [September 16, 2004, 3:32pm UTC](https://forum.servoy.com/t/defined-value-error/2709/4 "2004-09-16T15:32:13Z")

</div>

Bob,

I replaced the code to reflect:

if(approval\_date != null)  
{  
elements.BtnPrint.visible = true;  
elements.BtnRevise.visible = true;  
elements.BtnAddLine.visible = false;

}  
else  
{  
elements.BtnPrint.visible = false;  
elements.BtnRevise.visible = false;  
}

No Dice. The method works the same as it did with : if(approval\_date)  
It works, but I still get the same error.

Thanks,  
Erich

---

<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:** [September 16, 2004, 5:11pm UTC](https://forum.servoy.com/t/defined-value-error/2709/5 "2004-09-16T17:11:02Z")

</div>

Bob,

The field bid\_status is a stored calculation:

if (completion\_date == null)  
{  
return ‘Incomplete’;  
}  
else if (completion\_date && approval\_date == null )  
{  
return ‘Under Review’  
}  
else if (approval\_date)  
{  
return ‘Approved’  
}

I changed my original method to:

if (bidstatus == ‘Incomplete’)  
{  
elements.BtnAddLine.visible = true;  
elements.BtnPrint.visible = false;  
elements.BtnRevise.visible = false;  
}  
else if(bidstatus == ‘Under Review’)  
{  
elements.BtnPrint.visible = false;  
elements.BtnRevise.visible = true;  
elements.BtnAddLine.visible = false;  
elements.BtnSubmit.visible = false;  
}  
else if(bidstatus == ‘Approved’)  
{  
elements.BtnPrint.visible = true;  
elements.BtnRevise.visible = true;  
elements.BtnAddLine.visible = false;  
elements.BtnSubmit.visible = false;  
}

I get the undefined error for the date field that the bid\_status calaculation references.

What I noticed is that if I change the status and go from browse mode to desinger mode to browse mode I get the error. If I stay in browse mode and use my navigation buttons I don’t get an error.

Either way, I get the required results. I just want to know what the significance of the error is, it can’t be good, even though everything works fine if I stay in browse mode.

Thanks for any insite.  
Erich

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [September 20, 2004, 12:21pm UTC](https://forum.servoy.com/t/defined-value-error/2709/6 "2004-09-20T12:21:06Z")

</div>

those dates are just column/db values?  
can you for example see them on a form if you display them?

if they are just values of a row/record then you should be able to acces them. It shouldn’t matter if you did go to design or not. That only references to globals/javascript variables that are set by a startup script before you access that calculation.

---

<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:** [September 20, 2004, 12:24pm UTC](https://forum.servoy.com/t/defined-value-error/2709/7 "2004-09-20T12:24:15Z")

</div>

Yes, those dates are standard date fields located in the bids table.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [September 20, 2004, 12:36pm UTC](https://forum.servoy.com/t/defined-value-error/2709/8 "2004-09-20T12:36:02Z")

</div>

then that is very strange. I need to see a sample solution for that that demonstrates this.

---

<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:** [September 20, 2004, 12:43pm UTC](https://forum.servoy.com/t/defined-value-error/2709/9 "2004-09-20T12:43:24Z")

</div>

ok, I have uploaded the solution with sample data. The form in question is called ‘SalesRepBidCreationRecord’.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [September 20, 2004, 2:00pm UTC](https://forum.servoy.com/t/defined-value-error/2709/10 "2004-09-20T14:00:31Z")

</div>

ahh ok  
you access that variable in the onload!  
but there is no data yet when you do onload, the foundset is there yet. Only with onshow you have the foundset.

---

<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:** [September 20, 2004, 2:03pm UTC](https://forum.servoy.com/t/defined-value-error/2709/11 "2004-09-20T14:03:07Z")

</div>

ok, Thank you for the help.
