frienstra
20th June 2012, 12:29
I want to compare 2 fields. tccom001.emno which is a long field compare this with the 6 first characters of field tpppc232.desc which is a mbst.

Can somebody tell me what instruction I need to use ?

Thanks in advance.

Fons Rienstra

JaapJD
20th June 2012, 13:44
Depends on wheter the tpppc232.desc field holds the number with leading zeros and is right aligned or not.

Suppose tccom001.emno is 1234.

If desc contains 1234bbSome description (b=blank) then use

if str$(tccom001.emno) = tpppc232.desc(1;6) then

If desc contains bb1234Some description (b=blank) then use

if edit$(tccom001.emno,"ZZZZZ9") = tpppc232.desc(1;6) then

If desc contains 001234Some description (b=blank) then use

if edit$(tccom001.emno,"999999") = tpppc232.desc(1;6) then

frienstra
21st June 2012, 08:45
Hi Jaap,

Thanks for your reply. I will try your options and if I don't succeed I will come back to you.
Thanks again.
Fons

frienstra
21st June 2012, 09:07
Hi Jaap,

I see that tpppc232.desc is left aligned, so I'm not getting any good matching.
I have following values for instance.
tccom001.emno = 230211
tpppc232.desc = "230211 " 24 blanks after 230211
I tried the same with tpppc232.cdoc which is also mbst but only 10 characters.
Can you help me out ?
I'm trying to link those two fields in a report so that i can get the value tccom001.nama (the name of the employee) on my report.
Hopefully you can help me further ?

Fons

JaapJD
21st June 2012, 09:26
If I understand correctly you want to read the employee name based on tpppc232.desc. In that case you can write a query like this:

select tccom001.nama
from tccom001
where tccom001.emno = :1
as set with 1 rows
wherebind (1, lval(tpppc232.desc(1;6))
selectdo
....
endselect