validation code

Hi

I want to popup a info msg based on some validation.

If my validation fails then i want to popup a info msg on the screen while posting project invoice,

I wrote my validation in clicked method of post button.

but i understood that my code is not executing.

The class involve in posting is ProjFormLetter_Invoice. Can anyone tell me where i have to write my code?

Hi,

Try writing code in validate method of the Datasource in the form .

-Rajee

Actually the form i am talking about is projinvoiceproposal form. this form is not editable. If i write in validate method also its not working.

Else try writing in Validate Write method of the table for that specific field

Try Writing in Validate Write method of the table.

I tried already… [:(]

Hi Ajay,

It depends, on what u want to put validation.

If u r putting validation on the storing of data in table, u can put on validateWrite() method.

And if u want to put validation for the posting business logic, u can create method for that, like check in ProjFormLetter_Invoice class and can call that method in updateNow().

Check ProjFormLetter_Invoice class, we have some check<> method for reference.

Hope it helps…

Hi thanks for ur reply.

I just want to display a info message, Means i am not going to stop the data storage in table and i am not changing the business logic also,

My code is like this

CustTrans custTrans;
date duedate;
SysDate SysDate;

select projProposalJour
where projProposalJour.ProposalId == ProjProposalJour.ProposalId;

while select custTrans
where custTrans.AccountNum == ProjProposalJour.OrderAccount
&& custTrans.Voucher == ProjProposalJour.LedgerVoucher
{
duedate = custTrans.DueDate;
}

if(duedate < SysDate)
{
info(“due date exceeded”);
}

Based on the condition in the if loop i want to display the info message. this code i tried in validatewrite method of Projinvoiceproposal form. but its not working.because that form is not editable to the user.

Hi Ajay,

In the select statement

" select projProposalJour

where projProposalJour.ProposalId == ProjProposalJour.ProposalId;"

Is ‘projProposalJour’ is a object or datasourcename ?

If that is an object means the statement did not fetch any record

since you referring same object in both side : projProposalJour.ProposalId == ProjProposalJour.ProposalId

In the righhand side you should refer either datasource field or already fetched objects reference.

Best wishes

Rajabudeen

In the righthandside it is datasource name. lefthand side i am giving the object name.

Using BreakPoint, check the code whether value is assigend to duedate or not