pralash
22nd November 2017, 07:21
Hi,

I'm new for LN Programming.... I already know that we can get the condition matched records only if the specified condition is match in the select query as follows....

select tccom406.*
from tccom406
where tccom406.sex="male"
selectdo
do something
selectempty
endselect

Suppose I have the table with 10 records... In these records the tccom406.sex="male" for 6 records and the rest one has "female"

When I execute the query I got the 6 records which has tccom406.sex="male".... in selectdo option....

But can I get the remaining 4 records in the selectempty option....?
Can you please let me know that about the selectempty in detail?
Thanks in advance,
Regards,
Pralash

JaapJD
22nd November 2017, 11:05
No. In selectempty you can code something to be executed if the query result set is empty. If you want to have the 4 remaining records you have to do another query with where clause: where tccom406.sex <> "male".
Or as alternative, remove the where clause and code this in the selectdo:

if tccom406.sex = "male" then
...
else
...
endif

bhushanchanda
22nd November 2017, 11:29
Or just create a function like -

function print.data(string i.gender(6))
{
select tccom406.*
from tccom406
where tccom406.sex={:i.gender}
selectdo
|#Print your data
endselect
}

Now, simply call the function in your code like -

print.data("male")
print.data("female")

pralash
22nd November 2017, 11:42
Thanks so much for Bhushan & JaapJD.....
Now I understand clearly about "selectempty"...
Regards,
Pralash