pralash
6th November 2017, 15:02
Hi,
I'm new to LN Programming... I want to know that how to get the current login user name and time.... Is there any function are available in LN for finding the current user name and login time...
Please assists.
Thanks in advance,
Regards,
Pralash
srprks
7th November 2017, 07:47
before saving the record you can assign like
x = logname$
y = utc.num()
Thanks
pralash
7th November 2017, 09:30
Thanks so much....
It's working fine for me...
Regards,
Pralash
pralash
7th November 2017, 10:28
Hi,
By using the logname$, I got the current baan login user name... Similarly how can I get the full name of current login user name... Is there any other functions are available for getting the full name according to the user...
Can anybody assist to me for perform this task...
Thanks in advance
Regards,
Pralash
srprks
7th November 2017, 11:29
you can get those names from the table ttaad200 with 000 company.
that is ttaad200._compnr = 0.
pralash
7th November 2017, 11:53
Ok. Thank you very much...
Regards,
Pralash
pralash
7th November 2017, 13:48
As you told, I got the current user login date and time by using utc.num() function. It returns the long value(10 digits). I want to store this UTC format date in a table field. But I can't store the UTC format into the table....My script is as follows...
Can you please assist me how to fix this issue....
Note : while commenting the line "tctls902.logg=login.date" the record is inserted into the table. But when I uncomment this line "tctls902.logg=login.date" I got the fatal error. So can you please help me how to fix this....
The table definition of tctls902 as follows.
field domain
slno ttaad.comp
user ttaad.user
name ttdesa
log ttdate
|****************************** declaration section ***************************
table tttaad200 | Existing User Details
table ttctls902 | Current login user informations
#include <bic_dam> | This is included for perform the DAL operation
function main()
{
domain tcdate login.date
string login.name(80)
string full.name(80)
login.name = logname$ |Findout the current login user
login.date = utc.num() | Findout the login date and time in UTC format
select ttaad200.*
from ttaad200
where ttaad200._compnr = 0 and ttaad200.user = :login.name
selectdo
full.name = ttaad200.name | Full name of the login user
endselect
insert.into.table(login.name,full.name,login.date)
}
|****************************** function section ***************************
function insert.into.table(string login.name(80), string full.name(80),domain tcdate login.date)
{
message("Login User : %s",login.name)
message("Full name : %s",full.name)
message(login.date)
db.retry.point()
tctls902.slno=10
tctls902.user=login.name
tctls902.name=full.name
|tctls902.logg=login.date
dal.new("tctls902", ttctls902, e, true, db.retry,db.return.dupl)
if (e=0) then
message("inserted is %s", tctls902.user)
commit.transaction()
else
abort.transaction()
endif
}
bhushanchanda
7th November 2017, 15:10
Hi Pralash,
You need to convert the login.date to string using sprintf$() function.
e.g
domain tcdate login.date
login.date = utc.num()
message(sprintf$("Login Date/Time : %u(%02d/%02m/%04Y) %U(%02h%x%02m%x%02s %a)", login.date, login.date))
srprks
8th November 2017, 07:25
As you told, I got the current user login date and time by using utc.num() function. It returns the long value(10 digits). I want to store this UTC format date in a table field. But I can't store the UTC format into the table....My script is as follows...
Can you please assist me how to fix this issue....
Note : while commenting the line "tctls902.logg=login.date" the record is inserted into the table. But when I uncomment this line "tctls902.logg=login.date" I got the fatal error. So can you please help me how to fix this....
The table definition of tctls902 as follows.
field domain
slno ttaad.comp
user ttaad.user
name ttdesa
log ttdate
|****************************** declaration section ***************************
table tttaad200 | Existing User Details
table ttctls902 | Current login user informations
#include <bic_dam> | This is included for perform the DAL operation
function main()
{
domain tcdate login.date
string login.name(80)
string full.name(80)
login.name = logname$ |Findout the current login user
login.date = utc.num() | Findout the login date and time in UTC format
select ttaad200.*
from ttaad200
where ttaad200._compnr = 0 and ttaad200.user = :login.name
selectdo
full.name = ttaad200.name | Full name of the login user
endselect
insert.into.table(login.name,full.name,login.date)
}
|****************************** function section ***************************
function insert.into.table(string login.name(80), string full.name(80),domain tcdate login.date)
{
message("Login User : %s",login.name)
message("Full name : %s",full.name)
message(login.date)
db.retry.point()
tctls902.slno=10
tctls902.user=login.name
tctls902.name=full.name
|tctls902.logg=login.date
dal.new("tctls902", ttctls902, e, true, db.retry,db.return.dupl)
if (e=0) then
message("inserted is %s", tctls902.user)
commit.transaction()
else
abort.transaction()
endif
}
Hi The domain you took is only for date. you should take the domain as tcdate
VishalMistry
8th November 2017, 18:24
Hello Pralash,
I think you don't need to query table ttaad200 to retrieve user name . Once you get current login using logname$, please use the function tt.user to get name of the user. The syntax is as given below:
long tt.user(string user(12), ref string name() mb)
Vishal
pralash
9th November 2017, 12:20
Thanks so much for your reply...
Yes... It is very easiest way to find out full name of the user without accessing the table ttaad200...
Regards,
Pralash