learner
12th January 2003, 10:59
Hi,

I am a new bie in baan . I am querying on a table Supplier Master in my program script, now in this i am checking the following field Line of Business i.e. tccom020.cbrn

now for a partcular supplier SP0002 , when i ran the session tccom2101m000 it showed me the Line of business for this supplier as blank.

Now when i execute my script in debug mode, i saw that for this supplier my tcom020.cbrn was showing as tccom020.cbrn = " "

how come the 6 spaces were there where as it is showing as blank in Maintain Supplier Session


Following code i wrote in my program script

***************** start of code *************************

|Function to get the Supplier Name and Lines of business
function select.tccom020()
{
select tccom020.nama:sup.name,
tccom020.cbrn:line.of.bus, tccom020.sust
from tccom020
where tccom020._index1 = {:sup.cd}

selectdo
if line.of.bus = " LB02" then
line.of.bus.desc = "Manufacturers"
else
if line.of.bus = " LB01" then
line.of.bus.desc = "Traders"
else
if line.of.bus <> " " and (line.of.bus <> " LB01" or line.of.bus <> " LB02") then
line.of.bus.desc = "Others"
else
if line.of.bus = " " then
line.of.bus.desc = "Not Defined"
endif
endif
endif
endif


selectempty
sup.name = ""
line.of.bus.desc = "Not Defined"
endselect
}

****************** end of code *********************


now my doubt is this 6 spaces i came to know only during debug mode please tell me how do i handle this situation ? Is there any fnction available ?

mark_h
12th January 2003, 18:26
You can use the isspace function to test for blanks. I would use this code:


if isspace(line.of.bus) then
line.of.bus.desc = "Not defined"
else
line.of.bus.desc = "Others"
endif

You have already done checks for LB01 and LB02, so when it hits this check it will either be others if it is not blanks and not defined if it is spaces. You can use the library on the board for the isspace (http://www.baanboard.com/programmers_manual_baanerp_help_functions_string_operations_isspace) function and it is preferred over the strip$ function.

Good Luck!

Mark