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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
venkatg6759
Creator III
Creator III

Help needed with keepchar()

Hello Everyone,

I have the following expression

left(keepchar(if([Research - US Shares ()]&','&[Overall - US Shares ()]&','&[Research - All Products ()]&','&[Overall - All Products ()]<>',,,',[Research - US Shares ()]&','&[Overall - US Shares ()]&','&[Research - All Products ()]&','&[Overall - All Products ()]),'0123456789'),1).

Which gives me results like as shown

I need the highlighted cell to show result as 11

Logical.PNG.png

11 Replies
sudeepkm
Specialist III
Specialist III

Do you just want to show the highlighted one as without ',' or you want to have it on all the rows?

Can you please explain the logic from which all rows you want to remove the ','?

venkatg6759
Creator III
Creator III
Author

I want the result to be shown as 11.

The result should show only numbers that starts first regardless of ,

for the highlighted cell since it has ,,11,.

The value should show 11 which comes after ,

venkatg6759
Creator III
Creator III
Author

Can anyone help me on the expression

left(keepchar(if([Research - US Shares ()]&','&[Overall - US Shares ()]&','&[Research - All Products ()]&','&[Overall - All Products ()]<>',,,',[Research - US Shares ()]&','&[Overall - US Shares ()]&','&[Research - All Products ()]&','&[Overall - All Products ()]),'0123456789'),1)

Thanks,

Venkata

sudeepkm
Specialist III
Specialist III

"The result should show only numbers that starts first regardless of ,"

Do you mean to say that if you just have a single number in the cell then it should be display as number instead of the comma and number combination.

In that case many of other cell should also display the single number where ever the logic satisfy. Please clarify.

nizamsha
Specialist II
Specialist II

KeepChar( NewChar,'0123456789')

can u post some sample qvd so that we i can do

venkatg6759
Creator III
Creator III
Author

Find the sample QVD in the attachment.

The result should show                    

EMEA & Asia logicUS logic
33
44
22
33
11
11
22
44
11
77
44
33
88
22
22
33
11
11
33
22
66
88
11
44
11
55
1111

If there is two digits in it something like ,,11.It should show 11.

venkatg6759
Creator III
Creator III
Author

Can anyone help me with the expression.

Check the attached qvw and help me to get the result like

Logic                      EMEA & Asia Logic

,,,7                             7

,11,,,                          11

11 should come as result if logic is 11 .

Top 10 should appear as 10 .

Thanks.

Venkata

Not applicable

Try something like this. With so many IF statements you would want to be very wary of performance issues, but something like this may work if you put it in the script or don't have much data. 

(Replace(if(IsNull(if(SubField([US logic],',',1)<>'',SubField([US logic],',',1)))=0,if(SubField([US logic],',',1)<>'',SubField([US logic],',',1)),
if(IsNull(if(SubField([US logic],',',1)<>'',SubField([US logic],',',1))) and IsNull(if(SubField([US logic],',',2)<>'',SubField([US logic],',',2)))=0,if(SubField([US logic],',',2)<>'',SubField([US logic],',',2)),
if(IsNull(if(SubField([US logic],',',1)<>'',SubField([US logic],',',1))) and IsNull(if(SubField([US logic],',',2)<>'',SubField([US logic],',',2))) and IsNull(if(SubField([US logic],',',3)<>'',SubField([US logic],',',3)))=0,if(SubField([US logic],',',3)<>'',SubField([US logic],',',3)),
if(IsNull(if(SubField([US logic],',',1)<>'',SubField([US logic],',',1))) and IsNull(if(SubField([US logic],',',2)<>'',SubField([US logic],',',2))) and IsNull(if(SubField([US logic],',',3)<>'',SubField([US logic],',',3))) and IsNull(if(SubField([US logic],',',4)<>'',SubField([US logic],',',4)))=0,if(SubField([US logic],',',4)<>'',SubField([US logic],',',4)))))),'Top ',''),'Tier ','')

Example attached.

sebastiandperei
Specialist
Specialist

How do you need to show  "1,2,3,4", "1 or 2", ",Tier 2,,Tier 2" values?