metropoj
16th September 2010, 16:54
I need some guidance with the following syntax.

ffno below is a long value and copt is a 16 character string.

ffno in this case = 200015 and copt = " 200015"

I want to (strip$(shiftl$(tipcf520.copt) and make it a value I can compare to ffno.



select tccom851.*, tipcf520.*
from tccom851, tipcf520
where tipcf520.cpft="BrndItem" and tipcf520.cpva=:tdsls041.cpva and

**** tccom851.ffno = tipcf520.copt ****

selectdo
BrndDesc = tccom851.artd
endselect


I tried using val() str() and a number of attempted solutions but the syntax brings up various errors and doesn't like it ... :(

Can anyone suggest what I should be trying to do here to convert and compare ? Thanks in advance !

I know I am missing something simple but I can't seem to get it right ! maybe I need to convert the value ahead of time or ?

rberti
16th September 2010, 17:56
Hi Metropoj!

You can use 'wherebind' clause.
It would be like:

select tccom851.*, tipcf520.*
from tccom851, tipcf520
where tipcf520.cpft="BrndItem"
and tipcf520.cpva=:tdsls041.cpva
and tccom851.ffno = :1
wherebind(1, lval(tipcf520.copt))
selectdo
.....
endselect

This way, pseudo variable "1" will hold the value of the expression lval(tipcf520.copt).

Hope it helps!

Rafael

metropoj
16th September 2010, 18:02
Neat, I haven't seen that done before.

I also was just able to get around the problem by doing what I thought my next route as going to be, although a little longer than your solution posted ...

I created a long variable and assigned the val() of the entry to it.

CatalogNum = val(strip$(shiftl$(tipcf520.copt)))

then this worked:

select tccom851.*, tipcf520.* |# ehc0082.s Grab the Description from com851
from tccom851, tipcf520
where tipcf520.cpft="BrndItem" and tipcf520.cpva=:tdsls041.cpva and
tccom851.ffno =:CatalogNum
selectdo
BrndDesc = tccom851.artd


not elegant but it worked :) I'm gonna try yours out to replace all my code with that and see how it goes .... Thanks for your help ...

metropoj
29th September 2010, 20:42
Good Stuff, I used the wherebind clause in a constraint to convert and it worked great ! Thanks again .....