defined value error

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

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

Bob,
Thats wasnot my understanding because of a prior post

http://forum.servoy.com/viewtopic.php?t=2643&highlight=

Thans for clearing it up.

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

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

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.

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

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

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

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.

ok, Thank you for the help.