Check for a specific value in Text Field / Copystr

Hello there ! Got following problem, would be great if someone could help me : I have a field in which I have always “name, surname”. Now I want Navision to give me always the name. So I should tell Navision to begin looking in the field till it finds the “,” and then return what it found till then cutting of the “,”. Unfortunately I have no idea how to do that right now. Thanx, Christian

Forget about it… After having a coffe and thinking about it this did the job : name := mytable.name; x := STRPOS(name,’,’); surname := COPYSTR(mytable.name,1,x-1); Christian

Hy Christian There is an other way… just use SELECTSTR Use this function to retrieve a substring from a comma-separated string. NewString := SELECTSTR(Number, CommaString) Bye (Stefan);

The SELECTSTR has the disadvantage, that there may be no double expressions. So if you have a string like “name, surname, name before marriage” and “name” and “name before marriage” are the same (i.e. Smith, Mueller), the SELECSTR causes an error

Hy Stefan, you ar right, selectstr has some disandvantages. To avoid this i have a own selectstr function in my “codeunit-toolbox”. … hmm i remember, this was one of my first tools … Bye (Stefan);