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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Delete all integers/digits or characters after getting the 6 numbers needed

How can I replace/remove all the characters after the I get the 6 digits that I need?

 

My Data is:

 

Refer to ABC 123-456 06/13

 

My expression is:

 

row9.column == null ? null : row9.column.contains("Refer") ? row9.column.replace("(Refer to ABC","").replace("-","").replace("Refer ABC to","").replace("-","") : null 

 

Output is:

 

123456 06/13

or if the column values doesn't have Refer then null

 

Expected and should be the output:

 

123456

 

How can I remove all the characters after every 6th number that I need to extract?

 

 

 

Labels (1)
  • v7.x

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

 

    It depends on your string length of input data. You will have to add additional logic to handle input strings which is having less length compared to current one.

 

    The above post has helped you to break the barrier for your query for the input data shared in the post. But you will have to make necessary amendments based on your other input data 🙂 

 

    Don't worry, its not painful. I would say try for sometime of your own. If you are stuck, we all are here. You can share some sample data and we will see how it can be done. But I would strongly suggest you to give it a try for 2 to 3 hours so that you will learn basics thoroughly 🙂

 

Warm Regards,

 

Nikhil Thampi

View solution in original post

3 Replies
Anonymous
Not applicable
Author

Hi,

 

     You will have to use java functions to do it. Please refer below job (I believe I had given another way to do it in an earlier post to you).

0683p000009M14X.pngJob flow

 

0683p000009M11T.pngtmap

 

 

trim_input expression in Var

row1.input.replaceAll("\\pL+","").trim()


Output expression

Var.trim_input.substring(0, Var.trim_input.indexOf(" ")).replace("-","")

If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome 🙂

 

Warm Regards,

 

Nikhil Thampi

 

 

 

 

Anonymous
Not applicable
Author

This gives me outofboundindex error -1

Anonymous
Not applicable
Author

Hi,

 

    It depends on your string length of input data. You will have to add additional logic to handle input strings which is having less length compared to current one.

 

    The above post has helped you to break the barrier for your query for the input data shared in the post. But you will have to make necessary amendments based on your other input data 🙂 

 

    Don't worry, its not painful. I would say try for sometime of your own. If you are stuck, we all are here. You can share some sample data and we will see how it can be done. But I would strongly suggest you to give it a try for 2 to 3 hours so that you will learn basics thoroughly 🙂

 

Warm Regards,

 

Nikhil Thampi