Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SubField Function in qlikview

Hi all,

From the following, I jus want LA_GRMTH as the output.

Is this possible using SubField function?

"RPRPLA_GRMTH_CD","relatedparty":"'

Thanks all for you help.

Vidhya

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You can maybe use the occurence index in Textbetween() function:

TextBetween(FORM_DATA,'"relationshipinfo":[{"relationship":"R','_CD',1)as Primary_Relation,

TextBetween(FORM_DATA,'"relationshipinfo":[{"relationship":"R','_CD',2)as Secondary_Relation,


Secondary_Relation should be NULL in most records. You can decide what you want to do with these fields, e.g. concatenate into one or create a Hierarchy out of that.

View solution in original post

23 Replies
sunny_talwar

This just a single data point, what's the pattern here? share few more datapoints with the expected output to get a better response which will work across your database

Kushal_Chawda

Could be possible with Subfield but you need to provide few more data with expected output

swuehl
MVP
MVP

I agree that we need to come to a rule how the part of interest can be extracted from your input.

Looking at your sample, it would be difficult using Subfield(), but maybe using Textbetween():

=TextBetween('RPRPLA_GRMTH_CD','RPRP','_CD')

qlikview979
Specialist
Specialist

Hi Vidhya,

try this,

Mid('RPRPLA_GRMTH_CD',5,8) as MID

If u share your data with required output.  you will  get good response From Community.

Regards,

Mahesh.

Not applicable
Author

Thanks for the TextBetween function, but in my script, string is not constant and it will vary like the below.

Following are few examples

[{"relationship":"RPRPLA_GRMTH_CD","relatedparty":"LA_0"}]

 

[{"relationship":"RNMLA_WIFE_CD","relatedparty":"LA_0"}]

 

[{"relationship":"RNMLA_MOTH_CD","relatedparty":"LA_0"}]

 

[{"relationship":"RPRPLA_FATH_CD","relatedparty":"LA_0"}]

Output should be

LA_GRMTH

LA_WIFE

LA_MOTH

LA_FATH

Thanks in advance

chetansehgal
Creator
Creator

Hi Vidhya,

You can try below expression.

=index(Field_Name,$(vSearchString),1)

Field_Name is your field in the table

vSearchString is variable storing the string you want to search.

Can you please share the exact requirement as above function only returns the index of the search string in the main string.

Do you want to replace the string with some other string ?

Thanks,

Chetan

Not applicable
Author

Thanks for the TextBetween function, but in my script, string is not constant and it will vary like the below.

Following are few examples

[{"relationship":"RPRPLA_GRMTH_CD","relatedparty":"LA_0"}]

 

[{"relationship":"RNMLA_WIFE_CD","relatedparty":"LA_0"}]

 

[{"relationship":"RNMLA_MOTH_CD","relatedparty":"LA_0"}]

 

[{"relationship":"RPRPLA_FATH_CD","relatedparty":"LA_0"}]

Output should be

LA_GRMTH

LA_WIFE

LA_MOTH

LA_FATH

Thanks in advance

sunny_talwar

How about this:

'LA_' & TextBetween(FieldName, 'LA_', '"') as NewField

swuehl
MVP
MVP

Or maybe

'LA_' & TextBetween(FieldName, 'LA_', '_CD') as NewField