vamsi_gujjula
15th February 2016, 13:38
Hi guys,
I am trying to use a standard DLL which generates the GEO code if vertex integration is present.....tccom.dll4030.update.geocode(...)
Now in my custom address session, Geo code is mandatory which should be derived form above dll.
In dal --> before.save.object -> tccom.dll4030.update.geocode returns DALHOOKERROR ... i am setting an error message.But it doesnt show up because internally with in the DLL ( rather sub DLL ) .. dal.set.messages.off and dal.set.messages.on is being used .
Error that pops up is "Record not added"
Any suggestion how to pop my custom error.
bhushanchanda
15th February 2016, 16:06
Vamsi,
What you can do is, get the return value of the DLL and based on that, set your custom message and set dal.set.message.on() to show your custom message.
e.g. Following is my session where I am inserting the record via DAL.
dal.new.object("tcibd123")
dal.set.field("tcibd123.citg","BHU")
dal.set.field("tcibd123.dsca","Test")
ret = dal.save.object("tcibd123")
if ret = 0 then
commit.transaction()
else
dal.set.messages.on()
dal.set.error.message("@Test")
show.dal.messages()
abort.transaction()
endif
Following is my DAL -
function extern long before.save.object(long type)
{
dal.set.messages.off()
select tcmcs023.*
from tcmcs023
where tcmcs023._index1 = {:tcibd123.citg}
selectempty
return(DALHOOKERROR)
endselect
return(0)
}
I hope I understood the issue.
Though there might be some hidden undocumented variable to track it. Need to dig into it.
vamsi_gujjula
15th February 2016, 17:28
I am doing exactly what you have mentioned
function extern long before.save.object(long type)
{
if validate.geo.code() then |704697-001.sn
dal.set.error.message("gbcom43001")
return(DALHOOKERROR)
endif
...
...
...
}
function long validate.geo.code()
{
long l.ret
long o.no.of.geo.codes
domain tcgeoc o.geoc
domain tcname o.county.array(1) based
domain tcgeoc o.geo.code.array(1) based
l.ret = gbcom.dll4100.read.general.bp.request(gbcom430.rqno)
if not compnr.check(gbcom400.rfco) then
dal.set.error.message("tcmcss0000", gbcom400.rfco)
|* You are not authorized for Company Number %1$d.
return(DALHOOKERROR)
endif
if tctax.dll6100.tax.provider.interface.present() and
tctax.dll6103.country.registered.for.dest.sales.tax(
gbcom400.rfco,
gbcom430.ccty) then
free.mem(o.county.array)
free.mem(o.geo.code.array)
RETIFNOK.SWITCH.COMP(curr.comp,tccom.dll4030.update.geocode(
gbcom430.ccty,
gbcom430.ccit,
gbcom430.cste,
gbcom430.pstc,
gbcom430.namc,
"", | current GEO code
o.no.of.geo.codes,
o.geoc,
o.county.array,
o.geo.code.array))
endif
compnr.check(curr.comp)
return(0)
}
darkhorse
16th February 2016, 18:45
Very Correctly Said by Bhushan
In fact if there are multiple possible error message in DLL then additional extern variables can be used and message code can be set in that DLL and use that variable in dal.set.error.message of your script.
Value of extern variables can be retrieved by export and import
vamsi_gujjula
17th February 2016, 08:35
At darkhourse ... i feel you got me all wrong ... basically .. i am setting the error .. only thing is .. that doesnt pop up because DAL error message buffer (on / off functions used in standard dll) is blank and as result "Record not added" error .
:confused:
bhushanchanda
18th February 2016, 18:14
Hi,
Another thing you can try is -
dal.set.error.message("@Your_message")
while(dal.count.error.messages()) > 0
dal.get.error.message(err)
if trim$(err) = "Record not added" then
else
show.dal.messages()
endif
endwhile
Or another way is to create a 3GL to show your own error message and before calling it just set dal.set.messages.off()
vamsi_gujjula
19th February 2016, 13:46
will Play around next week
vamsi_gujjula
29th February 2016, 20:39
@bhushan.... tried your solution did not work for me..;)
dal.skip.messages is the variable i was looking for...:D:D