Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a data field [PHONE] that contains phone numbers and e-mails. I need to format the phone # during the load and I was trying to use the following:
LOAD
..
//
if (FindOneOf(PHONE, '@') > 0,
// e-mail
(PHONE as [Main Contact]),
// Phone Number or FAX
('+1 (' & Left(PHONE, 3) & ') ' & Mid(PHONE, 4, 3) & '-' & Right(PHONE, 4) as [Main Contact])),
......
FROM
.....
QV displays the error: "Error in expression: ')' expected" and I am not sure why.
I would appreciate an expert advice.
Regards,
VK
I think that the last bracket is too much, moreover you do not need to bracket the two IF-condition, thus think that
LOAD
..
// if (FindOneOf(PHONE, '@') > 0,
PHONE as [Main Contact],
// Phone Number or FAX
'+1 (' & Left(PHONE, 3) & ') ' & Mid(PHONE, 4, 3) & '-' & Right(PHONE, 4) as [Main Contact]),
......
FROM .....
Peter
Hi, Vladimir.
Does this work?
if (FindOneOf(PHONE, '@') > 0, PHONE, ('+1 (' & Left(PHONE, 3) & ') ' & Mid(PHONE, 4, 3) & '-' & Right(PHONE, 4))) as [Main Contact],
I think that the last bracket is too much, moreover you do not need to bracket the two IF-condition, thus think that
LOAD
..
// if (FindOneOf(PHONE, '@') > 0,
PHONE as [Main Contact],
// Phone Number or FAX
'+1 (' & Left(PHONE, 3) & ') ' & Mid(PHONE, 4, 3) & '-' & Right(PHONE, 4) as [Main Contact]),
......
FROM .....
Peter
Yes, it works. Thank you!
Thank you, Peter.