on 06-05-2013 11:59 AM
Hi
Could you please help me to solve the below question.
Eg. In my WebI report i have a column with customer name like eg. Maria George Asker.
But I have to display only middle name of the person like George.
Which function shall I use to solve above requirement.
Thanks
Hemlata
Hi Hemlata,
You can use substr to extract any string from other string , but you have to define the start point of extraction and the number of characters to extract.
Ex: Substr("Maria George Asker";7;6) would give you George.
I undertsand you requirement is more of dynamic, so your extraction point and number of characters would vary, In such cases you can use function POS to define position of first space character and define extract point as (position of space+1) and your number of characters would again go through one more substring as below.
Var1=substr(customer name;pos(customer name;" ")+1,length(customer name)-pos(customer name;" ")+1)) to extract the whole string "George Asker"
Var2=substr(Var1;1,pos(customer name;" ")-1) to extract "George" from "George Asker"
let me know if this helped
Thanks
Mallik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mallik is right, you can do some variations though.
1. the object and variable names must be in square brackets
2. for Var2 you can simply use Left([Var1];Pos([Var1];" "))
3. for Var1 instead of calculating the length you can use as length a huge number i.e. 500
Var1=substr([customer name];pos([customer name];" ")+1,500)
May seem marginal however in complex reports every little helps and can improve performance during the calculation phase.
Last but not least, the caveat that this is NOT an accurate method because there are people who may have a complex middle name, others may have a composite last name.
The rule would be to create a dedicated field in the database
Thanks
Simone
Hi Hemlata,
Is the issue resolved. Are you able to achieve this?
Thanks
Mallik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.