Baanboard.com

Baanboard.com (http://www.baanboard.com/baanboard/index.php)
-   Tools Development (http://www.baanboard.com/baanboard/forumdisplay.php?f=8)
-   -   Wrong Use of DAL Engine (http://www.baanboard.com/baanboard/showthread.php?t=69083)

Amit_Jain 13th July 2016 08:26

Wrong Use of DAL Engine
 
Hi

My process session halts at dal.save.object (for new records) and I get an Application error "Wrong use of DAL Engine".

Is there any way by which we can suppress this error message, because this message stops the flow of baan program. A user has to exit or Ignore this error message to continue with then program.

refer my code snippet here:

Code:

select        tiedm100.*
        from        tiedm100
        where        tiedm100._index1 = {:eitm, :revi}
        as set with 1 rows
        selectdo               
                return
        selectempty 
                dal.new.object("tiedm100")
                dal.set.field("tiedm100.eitm", eitm)
                dal.set.field("tiedm100.revi" ,  revi)
                dal.set.field("tiedm100.dsca" ,  dsca)
                if trim$(engi) <> "0" then
                        dal.set.field("tiedm100.engi" ,  engi)
                endif
                if not isspace(indt) then
                        dal.set.field("tiedm100.indt" ,  utc.indt)
                endif
                |if not isspace(exdt) then
                |        dal.set.field("tiedm100.exdt" ,  utc.exdt)
                |endif
                dal.set.field("tiedm100.unom"val(unom))
                dal.set.field("tiedm100.uset" ,  uset)
                dal.set.field("tiedm100.csig" ,  csig)
                dal.set.field("tiedm100.cuni" ,  cuni)
                dal.set.field("tiedm100.dscb" ,  dscb)
                dal.set.field("tiedm100.dscc" ,  dscc)
                dal.set.field("tiedm100.dscd" ,  dscd)
                dal.set.field("tiedm100.rele" ,  tiedm.rele.indesign)
                dal.set.field("tiedm100.cwun" ,  "lbs")
                dal.set.field("tiedm100.wght"val(wght))
                ret = dal.save.object("tiedm100", err.mess,db.return.error)
                if ret = 0 then
                        error = 0
                        commit.transaction()
                else
                        dal.get.error.message(err.mess)
                        status = seq.puts( err.mess & "|" & ts,fp2)       
                        abort.transaction()
                        counterbad = counterbad + 1
                        error = 1
                endif
        endselect


bhushanchanda 13th July 2016 10:11

Hi,

What is the error message return by dal.get.error.message() and what is the return value of dal.save.object().

There is a possibility that record already exists or may be its due to bad data due to domain mismatch.

Instead of suppressing, you may try to solve the issue. For suppressing, you can try setting error.bypass = true

vahdani 14th July 2016 12:47

Hi Amit,

I Think your dal.save.object() call is wrong. Especially the variable err.mess is not allowed in DAL2. Please use only
Code:


              ret = dal.save.object("tiedm100")


Amit_Jain 15th July 2016 09:20

Trial and error
 
Hi Vahdani

This code piece was a result of some Trial and error, which I did to suppress the error message popup. My original code has ret = dal.save.object("tiedm100").

@Bhushan: I am capturing return value and I know some of the data to be uploaded is not correct.
The problem is the size of data is big and I don't want my program to halt execution during upload.

I will try error.bypass=true and get back to you.

Thanks Vahdani and Bhushan for your valuable comments.

vamsi_gujjula 15th July 2016 11:09

ret = dal.save.object("tiedm100", err.mess,db.return.error)

From the guide function long dal.save.object (string tbl.name [, long error.flag])

should have been dal.save.object("tiedm100",db.return.error)


All times are GMT +2. The time now is 13:47.


vB.Sponsors
©2001-2017 - Baanboard.com - Baanforums.com