SAP Crystal Report How to extract everything to the right of a specific character in a field



If you want to display the right of a field after a specific character in the field, I have a way by using that you can achieve the same. For that you will have to following function MID,INSTR and RIGHT. for example you want to extract Ahmad from "Tasneem Ahmad".

First Way

Formula: MID({Stringfield},INSTR({String field},"")+1)

ex:MID("Tasneem Ahmad",INSTR("Tasneem Ahmad"," ")+1)

Above formula would return "Ahmad" as it Retrieves all the characters starting from the position of the space+1.

Second Way

By using the RIGHT, INSTR and STRREVERSE functions:

Function Descriptions:

RIGHT: Use this function to obtain the right part of a string.

INSTR: This function returns the position of the first occurrence of one string within another.

STRREVERSE:Return a string in which the character order of the input string is reversed

Formula :RIGHT(field,INSTR(STRREVERSE(field),"*")-1)

Formula : right({'FIELD'},instr(strreverse({'FIELD'}),"*")-1)