pralash
7th November 2017, 12:27
Hi,

I'm new to LN programming. Now i'm developing a 3GL script...
Can I use "DAL.new" in 3GL(Without 4GL engine)Script? Can anybody tell me please...
Thanks in Advance
Regards,
Pralash

bdittmar
7th November 2017, 13:48
Hello,

dal.new.object()
Syntax:

function long dal.new.object (string tbl.name)

Description

Use this to indicate the DAL that a new record is about to be inserted. This function set record defaults, by calling db.set.to.default() and the set.object.defaults() hook.

After this call, fields can be set with dal.set.field(). And after that, the record can be saved with dal.save.object().


Arguments

string tbl.name A string containing the name of the DAL.


Return values

0 OK
DALHOOKERROR The DAL could not be opened

Context

This function can be used in all script types.

Hooks called

before.open.object.set() if this is the first call to the DAL
before.new.object()
set.object.defaults()

Regards

pralash
7th November 2017, 13:51
Thanks a lot for your reply...
I'll try it...
Regards,
Pralash

bhushanchanda
7th November 2017, 15:05
Pralash,

To use DAL commands in 3GL, you need to include bic_dam library to your script. Here's a sample 3GL script for inserting record in table tcmcs045

#include<bic_dam>
function main()
{
long ret
dal.new.object("tcmcs045")
dal.set.field("tcmcs045.creg","XY")
dal.set.field("tcmcs045.dsca","Testing DAL with 3GL")
ret = dal.save.object("tcmcs045")
if ret = 0 then
commit.transaction()
message("Record saved")
else
abort.transaction()
message("Failed to insert record")
endif
}

pralash
8th November 2017, 13:05
Thanks so much for your reply...
It's working fine to me...
Regards,
Pralash