views:

69

answers:

1

I have a field in crystal report with the following data:
'605 KL1 - Daniel Steve'
How can i just remove the '605 KL1 - ' and leave the 'Daniel Steve' in the field only? Characters before '-' could be different, i hope the formula would automatically search for the '- ' and then show everything after it.

+2  A: 

MID can help here:

MID(my_string, 11) // will print your string from character 11 ("D") forward

And you can combine MID with INSTR if you need the display to be dynamic (of course this will only work if your data have a consistent format):

MID(my_string, (INSTR(my_string, "-") + 2))
Adam Bernier
Is it possible not to fixed the character index? As the characters before "-" could be different. I hope it can search for the '- ' and then show anything after '- '.
WeeShian
@WeeShian: just added another example to address this additional case.
Adam Bernier
Thank you so much! It works...
WeeShian