Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

Qlik Scripting help

Hello Qlikers,
 I'm working with survey Data . see attached QVF. My data has first 3 columns . For my analysis I need to create two metrics to find count( highest rating keys) and count( lowest rating keys).
 
I am trying to create a new column based out of value from 3rd column which I can use in my metric. for that I need to take numeric part from 3rd column(response value) starting with numbers. that from 0-10.
 
I tried using both Purgechar() and keepchar() . but doesn't seem to get desired result.
 
Prugechar() - NOTHING CHANGES
KeepChar()- seems to remove characters leaving behind numbers . where as I should be able to see numbers in newly created columns where values are between 0-10 .
e.g row-1 & row-4 should be blank & not 4 . row8 and row 12 should be  blank too. so dees line 14 & 17
 
 
Any help is greatly appreciated!
Labels (3)
7 Replies
Highlighted

I believe this works how you want it to:

If(SubField(ApplyMap('MapSamp',RESPONSEVALUECDWID), ' ', 1) <= 10, SubField(ApplyMap('MapSamp',RESPONSEVALUECDWID), ' ', 1)) AS New_Field

Highlighted
Creator II
Creator II

HI Nicole ,

I had tried this already . This fails for rows where values are  like

2982223 or more times3
3000384 or more sticks4
2987835 years or more5
3009435 years or more5
29882110 or more times10
30159210 or more times10

 

 

 

Highlighted

It works when I test it for those values (same calculation as my last post):

Nicole-Smith_0-1591046861019.png

Highlighted
Creator II
Creator II

first 3 rows from your screen shot are not ratings that are options for question. so when you do subfield <10 it displays 3 , 4,5 in new column for respective rows .

Highlighted

They are showing up because I added extra data for them to show up.  I still stand by that my expression from my previous post will work.  If it isn't working, can you post another QVF files with those values to show me?  Because the new values you mentioned aren't in your example, and I probably added them differently than how they would look in your data.

 

Highlighted
Creator II
Creator II

hi Nicole,

Please download QVF again.  I replaced it with new version.

Thanks

Highlighted

How do you know which values you want to use the numbers from and which ones you don't?  In order to code for it, I need to understand how to differentiate the ones that you want from the ones that should be NULL.