Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone,
Can anymone help to write a IF statement based on a criteria "starting by" in the script ?
I have a list of invoices in a database.
Each invoice refrence is starting by a key that is linked to a company.
For instance
Invoices starting by 71 is linked to company A
Invoices starting by 72 is linked to company B
Invoices starting by 73 is linked to company C
I am trying to create a variable "company" using below formulas in my script :
LOAD*,
if ([Nr facture] like 71*,'A',
if ([Nr facture] like 72*,'B',
if ([Nr facture] like 73*,'C'))) as Company;
But i got a message error.
Thanks in advance
Guillaume
Try adding single quotes around the search string
if ([Nr facture] like '71*','A',
if ([Nr facture] like '72*','B',
if ([Nr facture] like '73*','C'))) as Company;
May be this?
if (WildMatch([Nr facture]), '71*','A',
if (WildMatch([Nr facture]), '72*','B',
if (WildMatch([Nr facture], '73*','C'))) as Company;
Of course
Thanks Sunny
Anil you missed the closing parenthesis for the WildMatch function
if (WildMatch([Nr facture]), '71*'),'A',
if (WildMatch([Nr facture]), '72*'),'B',
if (WildMatch([Nr facture], '73*'),'C'))) as Company;