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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

From Script - Add new field according to values in another field

Hello All

I have a field named

"Summary_Text"

with data as follow

[SP] -  Factory 4545
[BF] - Error during Loadin
[IN] - Installation start fine

I need to create a new Field "Charge_Type" according to the text I have into the Bracket

[SP] ==> will be Site_prep

[BF] ==> will be Brake_Fix

[IN] ==> will be Installation

Thanks


Franck

5 Replies
ariel_klien
Specialist
Specialist

Hi,

Try:

LOAD if(TextBetween(SUMMARY_TEXT,'[',']')='SP','Site_prep',

            if(TextBetween(SUMMARY_TEXT,'[',']')='BF','Brake_Fix',

            if(TextBetween(SUMMARY_TEXT,'[',']')='IN','Installation'))) as Charge_Type;

SELECT SUMMARY_TEXT

from ....

BR

Ariel

swuehl
MVP
MVP

Try a mapping of your field values, like this:

TextMap:

MAPPING LOAD * INLINE [

Abb, Type

SP, Site_prep

BF, Brake_Fix

IN, Installation

];

LOAD

     Summary_Text,

     ApplyMap('TextMap', TextBetween(Summary_Text,'[',']') ) as Charge_Type,

     ...

FROM ...;

ariel_klien
Specialist
Specialist

better then my suggestion....

Not applicable
Author

Thanks To you , Ariel and Swuel

I am trying it

Not applicable
Author

Again thanks

Both way working, I learned from both of you .

BIG THANK