monica1
6th July 2005, 15:07
I need to send an information message in the check of a field.
The main table has DAL.
I write the condition in <field>.check(long has_changed) but now I don´t know how to send a message that don't stop the program.




Somebody can help me?

NPRao
6th July 2005, 20:38
Monica,

Use dal.set.error.message() and not send back the DALHOOKERROR. You would then have to use the functions dal.get.error.message() or dal.get.error.msgcode() to get the message from the stack to the calling program.
Here is a sample code.

function extern long zmmig200.proj.check(long has.changed)
{
if not has.changed then
return(0)
endif
select zmmig211.proj
from zmmig211
where zmmig211.proj = :zmmig200.proj
selectdo
selectempty
dal.set.error.message("zmmigs0045") |* Invalid Project Code
return(DALHOOKERROR)
endselect
return(0)
}

monica1
7th July 2005, 09:55
It doesn´t work. If I write return(0) the message doesn´t appear and if i write return(DALHOOOKERROR) the main program is stopped.

I need to do this but in the DAL.


field.zmmig200.proj:
check.input:
select zmmig211.proj
from zmmig211
where zmmig211.proj = :zmmig200.proj
selectdo
selectempty
mess("zmmigs0045") |* Invalid Project Code
endselect

Evert-Jan Bosch
11th July 2005, 11:15
2 things are needed.
1. In the DAL: set the error message and return(0).
2. In the UI script: for example in section after.update.db.commit: display the error message in following way:
after.update.db.commit:
domain tcmcs.str256m error.message
dal.get.error.message(error.message)
message(error.message)
By the way: in ERP LN you also have the possibility to set and retrieve info messages. That's better than using the error stack mechanism for info messages.

kathuria
14th July 2005, 14:57
Hi,

I am making changes in N P rao Script.

function extern long zmmig200.proj.check(long has.changed)
{
if not has.changed then
return(0)
endif
select zmmig211.proj
from zmmig211
where zmmig211.proj = :zmmig200.proj
selectdo
selectempty
dal.set.error.message("zmmigs0045") |* Invalid Project Code
return(1) | Added by Sanjay Kathuria

| return(DALHOOKERROR)
endselect
return(0)
}



Sanjay Kathuria