Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to split value to two values

Hi,

I have PhoneNoMobile and PhoneNoWork columns in sql table with values 447341891543,447897674285 as combined in PhoneNoMobile  and column PhoneNoWork contains some NULL values and values with Data .

I have to split the above value as PhoneNoMobile=7341891543 and PhoneNoWork=447897674285

Is it possible to get this and I have to split this values only when PhoneNoWork contains NULL values i,e if PhoneNoWork=NULL then it should replace with 44789674285. Please help

Thanks.

1 Solution

Accepted Solutions
marcus_sommer

Try this:

If(isnull(PhoneNoWork),Subfield(PhoneNoMobile,',',2),PhoneNoWork)

- Marcus

View solution in original post

11 Replies
javier_florian
Creator III
Creator III

You create an expression:

If(IsNull(PhoneNoMobile),If(IsNull(PhoneNoWork),'No phone number',PhoneNoWork),PhoneNoMobile)

Not applicable
Author

Thanks and it's showing same values as PhoneNoMobile in PhoneNoWork but I have to get the second Phone No in PhoneNoWork if PhoneNoWork contains NULL Values only.

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

try this on your load statement

Alt(PhoneNoWork, PhoneNoMobil) as PhoneNoWork

Regards,

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!
marcus_sommer

For such a splitting you could use subfield like subfield(FIELD, ',', 1) as FIELD1.

- Marcus

Not applicable
Author

Thanks and still it's showing as earlier any help please.

javier_florian
Creator III
Creator III

Can you include a value like an example? Function with IsNull or Alt must works...

Not applicable
Author

Thanks and if PhoneNoWork contains NULL values will below expression work?

If(PhoneNoWork='NULL',Subfield(PhoneNoMobile,',',2),PhoneNoWork)

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Yes,

but I think

Alt(PhoneNoWork, Subfield(PhoneNoMobile,',',2))

is better

Help users find answers! Don't forget to mark a solution that worked for you!
marcus_sommer

Try this:

If(isnull(PhoneNoWork),Subfield(PhoneNoMobile,',',2),PhoneNoWork)

- Marcus