Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

QSense
Contributor II

subfield

Hello,

I have oen column in my table it is about title

it includes name ,department and title so I want to take only title part

for example

John Deep(Information Tecnology Department) - Chief Information Officer) I want to take bold part (title)

Tags (1)
1 Solution

Accepted Solutions

Re: subfield

Do all fields like this have a hyphen in them?  If so,

=subfield(subfield(Field, '-', 2), ')', 1)

The inner subfield will take everything after the hyphen.  The outer subfield will take away the closing parenthesis at the end of it.

7 Replies

Re: subfield

Do all fields like this have a hyphen in them?  If so,

=subfield(subfield(Field, '-', 2), ')', 1)

The inner subfield will take everything after the hyphen.  The outer subfield will take away the closing parenthesis at the end of it.

QSense
Contributor II

Re: subfield

Hi Nicole ,

İf name includes more than one hyphens What should it be?

For example

John Deep((Information Tecnology Department/Urp-Ist) - Chief Information Officer)

Urp-Ist is Location name abbreviation.

Re: subfield

=subfield(subfield(Field, '-', 3), ')', 1)

QSense
Contributor II

Re: subfield

For this example AHMET MENNAN MUFTUOGLU (Paz.& Sat.Bsk.(Yurtici) (Yurtici Ticaret Md./Psyi-Ist) - Uzman)

your code's result is : Ist

Re: subfield

It shouldn't be giving you Ist if you use 3 instead of 2 because it is saying take the 3rd section after stripping out the hyphens.  But if it's giving you Ist, then try it with a 4 instead of a 3

i.e.

=subfield(subfield(Field, '-', 4), ')', 1)

QSense
Contributor II

Re: subfield

It is the same and also

MURAT IRDESEL (Pazarlama ve Satis Bsk.(2.Bolge) (Taskent Md./Ps2) - Sef(Ticaret)(Yd))  for this sample,It only gives Sef(Ticaret   this result with '2' in code

When I make it '3' It gives no result


Re: subfield

For AHMET MENNAN MUFTUOGLU (Paz.& Sat.Bsk.(Yurtici) (Yurtici Ticaret Md./Psyi-Ist) - Uzman)

=subfield(subfield(Field, '-', 3), ')', 1)     (will return Uzman)

For MURAT IRDESEL (Pazarlama ve Satis Bsk.(2.Bolge) (Taskent Md./Ps2) - Sef(Ticaret)(Yd))

=left(subfield(Field, '-', 2), len(subfield(Field, '-', 2)) - 1)     (will return Sef(Ticaret)(Yd))

See attached.

Is there anything that is consistent between all of your fields?  It isn't good to have to write different expressions for each field.

Community Browser