tracylee
6th July 2018, 10:10
Hi,

Now i try to write a dll script but when I compile a script prompt the message "Error: Unresolved reference to function 'tcmcs.dll0050.check.and.generate.order.number'.
". Please refer my script. Please advise. Thanks.

|******************************************************************************
|* tccus020 0 VRC B61C a pmb
|* DAL for Project Order - Header
|* is
|* 06-07-18 [13:49]
|******************************************************************************
|* Script Type: DAL
|******************************************************************************

#include <bic_dal2>
#define NUMBER.GROUP "PRJ" | Project Order Header - Series No.

table ttccus020 | Project Order
table ttcmcs050 | First Free Numbers
table ttcmcs051 | Number Groups


function extern long set.object.defaults()
{
tccus020.user = toupper$(logname$)
tccus020.nrgr = NUMBER.GROUP
tccus020.hsta = tchsta.new

return(0)
}

function extern long before.open.object.set()
{
dal.field.depends.on("tccus020.srno", HOOK_UPDATE, "tccus020.orno")

return(0)
}

function extern long before.save.object(long type)
{
long ret
domain tcorno orno

if type = DAL_NEW then


orno = tccus020.orno
ret = tcmcs.dll0050.check.and.generate.order.number(3, orno, tccus020.nrgr, 9, "")

tccus020.orno = orno
endif

return(0)
}

function extern long tccus020.orno.check(long has_changed)
{
long ret, cnt

ret = 0
cnt = 0

if has_changed = DAL_NEW then

select count(*) :cnt
from tcmcs050
where tcmcs050.nrgr = :tccus020.nrgr
and tcmcs050.seri = :tccus020.orno
selectdo
break
endselect

if cnt = 0 then
|| Invalid requisition number!
dal.set.error.message("txcus00001")
ret = DALHOOKERROR
endif

endif

return(ret)
}

function extern void tccus020.srno.update(long has_changed)
{
if has_changed = DAL_NEW then
tccus020.srno = tccus020.orno
endif
}

function extern boolean tccus020.hsta.is.derived()
{
return(true)
}

function extern boolean method.is.allowed(long method)
{
boolean ret
long cnt

ret = true

on case method
case DAL_NEW:

break

case DAL_UPDATE:

break

case DAL_DESTROY:

on case trim$(tccus020.srno)
case "POR":
select count(*) :cnt
from tccus021 a1
where a1.orno = :tccus020.orno
and a1.lsta not in(tclsta.canceled, tclsta.rejected)
selectdo
break
endselect

ret = (cnt = 0 and tccus020.hsta = tchsta.new)

break
endcase

break
endcase

return(ret)
}

vahdani
6th July 2018, 10:25
hi,

the compiler cannot find the function. For us it is easy to know that the function is in the DLL tcmcsdll0050 but we must also tell this to the compiler!!

You could add tcmcsdll0050 to the list of Libraries. Just mark your DAL and call "libraries" option
... or you can add the library to the script as follows:
table ttccus020 | Project Order
table ttcmcs050 | First Free Numbers
table ttcmcs051 | Number Groups

#pragma used dll otcmcsdll0050 |Check order series
... and don't forget the "o" :D

tracylee
6th July 2018, 10:36
hi,

the compiler cannot find the function. For us it is easy to know that the function is in the DLL tcmcsdll0050 but we must also tell this to the compiler!!

You could add tcmcsdll0050 to the list of Libraries. Just mark your DAL and call "libraries" option
... or you can add the library to the script as follows:
table ttccus020 | Project Order
table ttcmcs050 | First Free Numbers
table ttcmcs051 | Number Groups

#pragma used dll otcmcsdll0050 |Check order series
... and don't forget the "o" :D

Hi Vahdani,

Thanks for your reply. Now can compile after add the library to the script. Thanks a lot.