VishalMistry
1st April 2015, 12:32
Hello,
I want to count number of records where date field is not entered (field is date/time,tdsls100.prdt in sales quotation)
how can I check if user has entered any value in tdsls100.prdt or not ?
Pl guide.
Vishal
bhushanchanda
1st April 2015, 13:55
Hi,
Blank date should have 0 value.
So, you can do this
long cnt
cnt = 0
select tdsls100.*
from tdsls100
where tdsls100.prdt = 0
selectdo
cnt = cnt + 1
endselect
| Not cnt should have total no of records where date is not entered
You can also use count() function in your select.
VishalMistry
2nd April 2015, 07:51
Hello,
I tried the following but it did not work:
select select sum(*):tot from ttdsls100 where tdsls100.prdt = 0
selectdo
endselect
but it is not working
is there anything wrong in above query ?
Vishal
vamsi_gujjula
2nd April 2015, 11:35
Vishal are you kidding me..;)...
you cannot have sum (*) , sum is addition of some numeric values ..;)
should be count ... and btw .. you can do it as bhushan said.
VishalMistry
2nd April 2015, 12:21
Vishal are you kidding me..;)...
you cannot have sum (*) , sum is addition of some numeric values ..;)
should be count ... and btw .. you can do it as bhushan said.
Oh sorry.
I mean count(*).
still it did not work.
Vishal
VishalMistry
2nd April 2015, 13:13
Hello.
When I am checking through utc.to.date (tdsls100.prdt, yr, mn, dy, hr, mnt, sec), the yr variable contains 1970 and mn and dy contains 1 respectively.
for the time being I have written following query to check if prdt is blank:
select tdsls100.*
from tdsls100
where (tdsls100.qsta = tcqsta.booked or tdsls100.qsta = tcqsta.printed or tdsls100.qsta = tcqsta.modified)
and tdsls100.osrp <> "" and tdsls100.prdt = 0
selectdo
utc.to.date (tdsls100.prdt, yr, mn, dy, hr, mnt, sec)
if yr = 1970 then
pdgn = pdgn + 1
endif
endselect
But this does not sound practical. Pl guide.
Vishal
mark_h
2nd April 2015, 18:57
If the query works then you can always check for dates not entered. What you need to do is go into the session where the user should enter a date and change it. I will have to let someone else who knows LN recommend how. In 4c4 we don't own source code and I would use qkey and just put in an after.input section to check if date is 0.
Once that is working after the other records are fixed you can retire the query.