Forum Discussion
MattStephens
8 years agoQrew Cadet
How many colons could you possibly get in the invoice line description?
If it's only a handful, you could check the text to the left of each colon to see if it is "Consultant", and if it is, use the text to the right. Something like this:
//Get all the text parts between colons(:)
var text texta = Part([Descsription],1,":");
var text textb = Part([Descsription],2,":");
var text textc = Part([Descsription],3,":");
var text textd = Part([Descsription],3,":");
//Find which part contains "Consultant", and then use the next part.
var text NamePart =
Case("Consultant",
Right($texta,10),$textb,
Right($textb,10),$textc,
Right($textc,10),$textd);
//Get the first and last name
var text FirstName = Part($NamePart,2," \n");
var text LastName = Part($NamePart,3," \n");
//Create the display anme
$FirstName & " " & $LastName
If it's only a handful, you could check the text to the left of each colon to see if it is "Consultant", and if it is, use the text to the right. Something like this:
//Get all the text parts between colons(:)
var text texta = Part([Descsription],1,":");
var text textb = Part([Descsription],2,":");
var text textc = Part([Descsription],3,":");
var text textd = Part([Descsription],3,":");
//Find which part contains "Consultant", and then use the next part.
var text NamePart =
Case("Consultant",
Right($texta,10),$textb,
Right($textb,10),$textc,
Right($textc,10),$textd);
//Get the first and last name
var text FirstName = Part($NamePart,2," \n");
var text LastName = Part($NamePart,3," \n");
//Create the display anme
$FirstName & " " & $LastName