pkatanic
5th October 2015, 17:31
Hello,
I have data like this (04307 1820,07053 10, 3 10, 1 270...etc) in table tfcmg301.orig. What I have to do is to take numbers after whitespace and join. how to detect whitespace position in the string? Maybe to use TRIM function?
And for the end, I should compare result with tdpur401.pono and tdpur 401.orno like in query below, where orig.array should be number without whitespace. But pono and orno are not strings. What to do?

function boolean get.tcibd001() {
Select tcibd001.dsca :item,
tcibd001.citg :citg ,
tdpur401.pono : pono,
tdpur401.orno : orno

from tcibd001 inner join tdpur401 on tcibd001.item=tdpur401.item
|where pono = : orig.array
SELECTDO
ENDSELECT
return (true)

}

bhushanchanda
5th October 2015, 18:55
Hi,

You can use string.scan() function to do that. Also, your select won't be supported in Baan/LN. The following code snippet might get you going.

extern domain tffst.clds orig.array(5)
function main()
{
long i
domain tcorno orno
domain tcpono pono
orig.array(1,1) = "ABC000001 10"
orig.array(1,2) = "XYZ000001 10"
orig.array(1,3) = "XYZ000001 20"

i = 1
while(not isspace(orig.array(1,i)))
string.scan(orig.array(1,i),"%s %d",orno,pono)
get.tcibd001(orno,pono) |# Call your Function Here
i = i + 1
endwhile
}

function domain tcbool get.tcibd001(domain tcorno i.orno, domain tcpono i.pono)
{
select tcibd001.dsca
from tcibd001,tdsls401
where tdsls401._index1 = {:i.orno,:i.pono}
and tdsls401._index9 refers to tcibd001
as set with 1 rows
selectdo
return(true)
endselect

return(false)
}

pkatanic
6th October 2015, 14:28
Thanks. Can you please explain what is tdsls401?

bhushanchanda
6th October 2015, 14:32
Just make it tdpur401 and use index8 instead of index9.

Here's updated code.


extern domain tffst.clds orig.array(5)
function main()
{
long i
domain tcorno orno
domain tcpono pono
orig.array(1,1) = "ABC000001 10"
orig.array(1,2) = "XYZ000001 10"
orig.array(1,3) = "XYZ000001 20"

i = 1
while(not isspace(orig.array(1,i)))
string.scan(orig.array(1,i),"%s %d",orno,pono)
get.tcibd001(orno,pono) |# Call your Function Here
i = i + 1
endwhile
}

function domain tcbool get.tcibd001(domain tcorno i.orno, domain tcpono i.pono)
{
select tcibd001.dsca
from tcibd001,tdpur401
where tdpur401._index1 = {:i.orno,:i.pono}
and tdpur401._index8 refers to tcibd001
as set with 1 rows
selectdo
return(true)
endselect

return(false)
}

pkatanic
6th October 2015, 14:36
Thanks a lot!