Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
piyush_s11
Creator
Creator

Qlik Sense replace second occurrence of dash (-) with semicolon (;)

Hi Team, I have a field where it consist combination of two fields with dash (-), I want to replace the dash (-) which is second occurrence with semicolon (;)

Please find below table example for the same.

program_service_name                                                     expected output
PR-032419-Basel IV                                                               PR-032419; Basel IV
PR-038690-SA-CCR for PRA and FINMA LVE                PR-038690; SA-CCR for PRA and FINMA LVE
PR-038691-Capital Strategic Alignment                       PR-038691; Capital Strategic Alignment
PR-039121-PRA Program                                                    PR-039121; PRA Program
PR-041121-Continuous Compliance                             PR-041121; Continuous Compliance
PR-042921-Capital End of Life                                         PR-042921; Capital End of Life
PR-043707-PRA Basel 3 Reforms                                    PR-043707; PRA Basel 3 Reforms
BC-04529-Continuous Compliance                              BC-04529; Continuous Compliance
BC-04535-B3 Migration                                                      BC-04535; B3 Migration

Please note that we have to replace second occurrence of dash (-) as in project code dash (-) is already present. Also in some places Program service name also consist dash(-). 

Qlik Sense Business 

@avinashelite @tresesco @sunny_talwar @kushalthakral @MayilVahanan @Anil_Babu_Samineni @kaushiknsolanki 

 @Anonymous @Anonymous @swuehl 

 

Labels (5)
2 Solutions

Accepted Solutions
kushalthakral
Creator III
Creator III

Please try like below

Load
*,
SubField(F1,'-',1)&'-'&SubField(F1,'-',2)&';'&SubField(F1,'-',-1)
;
LOAD * INLINE [
F1
P4-1234-abc
];

 

Thanks

Kushal

View solution in original post

MayilVahanan

Hi 

Try like below

LOAD *,Left(program_service_name, FindOneOf(program_service_name,'-',2)-1)&';'&SubField(program_service_name,'-',-1) as Output INLINE [
program_service_name
PR-032419-Basel IV
PR-038690-SA-CCR for PRA and FINMA LV
PR-038691-Capital Strategic Alignment
PR-039121-PRA Program
PR-041121-Continuous Compliance
PR-042921-Capital End of Life
PR-043707-PRA Basel 3 Reforms
BC-04529-Continuous Compliance
BC-04535-B3 Migration
];

 

O/p:

MayilVahanan_0-1648551601667.png

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

4 Replies
kushalthakral
Creator III
Creator III

Please try like below

Load
*,
SubField(F1,'-',1)&'-'&SubField(F1,'-',2)&';'&SubField(F1,'-',-1)
;
LOAD * INLINE [
F1
P4-1234-abc
];

 

Thanks

Kushal

MayilVahanan

Hi 

Try like below

LOAD *,Left(program_service_name, FindOneOf(program_service_name,'-',2)-1)&';'&SubField(program_service_name,'-',-1) as Output INLINE [
program_service_name
PR-032419-Basel IV
PR-038690-SA-CCR for PRA and FINMA LV
PR-038691-Capital Strategic Alignment
PR-039121-PRA Program
PR-041121-Continuous Compliance
PR-042921-Capital End of Life
PR-043707-PRA Basel 3 Reforms
BC-04529-Continuous Compliance
BC-04535-B3 Migration
];

 

O/p:

MayilVahanan_0-1648551601667.png

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
piyush_s11
Creator
Creator
Author

Hi @kushalthakral 

thanks for your quick help.

one more thing I forgot to add is I have field value as Not Available-Not Available as well how to convert this with syntax Not Available; Not Available with above suggested formula. 

 

piyush_s11
Creator
Creator
Author

Hi @MayilVahanan 

thanks for your quick help.

one more thing I forgot to add is I have field value as Not Available-Not Available as well how to convert this with syntax Not Available; Not Available with above suggested formula.