Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Confusion in using Subfield in load script as well as in expression

Hey ppl,

In one of a qvd i have column with values like,

ABCD-0070085158
BSCD-0070085178
JKRF-0070085153
QOPD-0070085238

I want to display the values like ,

70085158
70085178
70085153
70085238

I tried SubField(ID,'0') as NewID in the script , but it doesn't work

I tried the same by simply loading the data like Load ID as OldID and used SubField(OldID,'0') in the expression in the Pivot Straight table, but no luck

I think this is because, there are multiple zeros in between the data.  How do I display as desired ? Any other substring kind of functions will help or any workaround solution?


TIA,

James



1 Solution

Accepted Solutions
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

This option then:

=SubField('ABCD-0070085158','-00',2)

View solution in original post

11 Replies
sunny_talwar

What is the question here my friend?

Not applicable
Author

Sorry Sunny ,

Some keyboard shortcut posted the query automatically while i was composing ... Now I edited the post...

-James

MindaugasBacius
Partner - Specialist III
Partner - Specialist III

If you are willing to split the field try using:

SubField(Field_name, '-') as First_param,

SubField(Field_name, '-', 2) as Second_param


Read more:

SubField ‒ QlikView


I suggest you to bookmark this page

Home ‒ QlikView

puttemans
Specialist
Specialist

try right(subfield(ID,'-', 2), 😎

florentina_doga
Partner - Creator III
Partner - Creator III

use

=num(subfield('ABCD-0070085158','-',-1))

MindaugasBacius
Partner - Specialist III
Partner - Specialist III

This option then:

=SubField('ABCD-0070085158','-00',2)

sunny_talwar

How about this:

SubField(ID,'-', 2) * 1 as NewField

jonathandienst
Partner - Champion III
Partner - Champion III

Try

=Replace(LTrim(Replace(SubField(ID, '-', 2), '0', ' ')), ' ', '0')

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

instead of subfield you may use (if the values are in above Format)

num(Keepchar(ID,'0123456789','#0')