Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
pra_kale
Creator III
Creator III

How to insert "_" after a specific letter

Hi,

In my data in 1 column I have member numbers in different formats like '01ED2', '01EF3' ,'01E12','0E245','039E9','12345E12','E1234' etc

I want to insert "_" only if after E there is a number else member number will remain as it is..for e.g I will get out-put like this

01ED2', '01EF3' ,'01E_12','0E_245','039E_9','12345E_12','E_1234'


By below given function I able to found whether string is having "E" in it but finding difficult to set other conditions.


If( FindoneOf(MEMBER,'E')  ,'Found it','Not Found')


Thanks in Advance


stalwar1

kush141087

1 Solution

Accepted Solutions
sunny_talwar

My bad, try this

Table:

LOAD *,

If(IsNum(Left(SubField(FieldName, 'E', 2), 1)), SubField(FieldName, 'E', 1) & 'E_' & SubField(FieldName, 'E', 2), FieldName) as NewFieldName;

LOAD * INLINE [

    FieldName

    01ED2

    01EF3

    01E12

    0E245

    039E9

    12345E12

    E1234

];

View solution in original post

4 Replies
sunny_talwar

May be this

If(IsNum(Left(SubField(FieldName, 'E', 2), 1), SubField(FieldName, 'E', 1) & 'E_' & SubField(FieldName, 'E', 2), FieldName)

sunny_talwar

My bad, try this

Table:

LOAD *,

If(IsNum(Left(SubField(FieldName, 'E', 2), 1)), SubField(FieldName, 'E', 1) & 'E_' & SubField(FieldName, 'E', 2), FieldName) as NewFieldName;

LOAD * INLINE [

    FieldName

    01ED2

    01EF3

    01E12

    0E245

    039E9

    12345E12

    E1234

];

shahenda_ebead
Contributor
Contributor

@pra_kale

Do you expect to see the E letter more than once in your field string or it will be just there once

pra_kale
Creator III
Creator III
Author

Thanks Sunny...It is perfectly working..