Filter Code Vendor

Hi Everybody

If use function IF xxx* not work

IF “Vendor No.” =‘100*’ THEN textCompany:=‘US’;
IF “Vendor No.” = ‘200*’ THEN textCompany:=‘UK’;
IF “Vendor No.” = ‘300*’ THEN textCompany:=‘SJ’ ;

But not work. Please fix code. Thanks very much.

Best Regards

Dinh Son

Dinh,

The vendor no. cannot contain “*” - so it will never be true!

Also you should NEVER harrdcode such values into your code. Such a hardcoded logic will ALWAYS change. So you should use setup tables instead of hardcoding any values!

I guess you’re trying to use it similar to LIKE in SQL and you want to evaluate the 3 first characters of the vendor no?

the instead something like this

VendNo3 := COPYSTR(“Vendor No.”,1,3);

CASE VendNo3 OF

‘100’ : textCompany := ‘US’;

etc.

Thanks Erik**.**

Hi Dinhson,

You’re welcome. Please verify my answer as the solutions, if it helped you. Thanks.