SSRS expression to get first character from string -


i having field string values "first middle last" , want show initial characters string "fml"

how can in terms of ssrs expression ?

assuming field mystring has 3 words following find first character of first, second , last words. admittedly doesn't handle instances there more or less 3 words, should started if require more finesse.

=left(fields!mystring.value, 1) + " " +  left(mid(fields!mystring.value, instr(fields!mystring.value, " ") + 1), 1) + " " +  left(mid(fields!mystring.value, instrrev(fields!mystring.value, " ") + 1), 1) 

edit

to cope possiblity of 2 words (as suggested in commetns below) check index of spaces used ensure not same, , 3 words exist. make code follows

=left(fields!mystring.value, 1) + " " +  left(mid(fields!mystring.value, instr(fields!mystring.value, " ") + 1), 1) +  iif(instrrev(fields!mystring.value, " ") > instr(fields!mystring.value, " "),    " " + left(mid(fields!mystring.value, instrrev(fields!mystring.value, " ") + 1), 1),    "") 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -