Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Replace one single character from all columns

Hi All,

I have a requirement,In my table  I want to replace \n character with null() from all column.

I can use if condition

if(Col1='\n',null(),Col1) as Col1

But in my table there are above 100 coumn. So is there any alternative let me know..

1 Solution

Accepted Solutions

Re: Replace one single character from all columns

If you're loading data from text files or excel files you can use the NullInterpret variable. If you add this line at the beginning of your load script then all \n values will be replaced with nulls:

set NullInterpret='\n';


talk is cheap, supply exceeds demand
7 Replies
MVP
MVP

Re: Replace one single character from all columns

Hi Sumita,

It is better to replace manually by using the If, instead of doing dynamically. 

Regards,

Jagan.

Not applicable

Re: Replace one single character from all columns

Hi ,

In my case I am fetching the data from text file and manually is not possible because there are several  column.

And then i have to use the data for further calculation.

MVP
MVP

Re: Replace one single character from all columns

Hi,

You have to use this

if(Col1='\n',null(),Col1) as Col1

for all the columns.  I think this is the best option when comparing to do this dynamically, it needs lot of scripting and it leads to performance issues.

Hope this helps you.

Regards,

Jagan.

Not applicable

Re: Replace one single character from all columns

Hi,

Yes i was initially using that but as i mentioned that in my table there are more than 100 column, in which it is not possible and exactly it will degrade the performance.

Thatsy I am looking for alternative solution.(like loop which read my column name and apply that condition. )

Because \n is coming in approx all column.

Not applicable

Re: Replace one single character from all columns

Sumita,

please provide an example we can work with (example.qvw or Excel).

Thank you!

Rainer

Re: Replace one single character from all columns

If you're loading data from text files or excel files you can use the NullInterpret variable. If you add this line at the beginning of your load script then all \n values will be replaced with nulls:

set NullInterpret='\n';


talk is cheap, supply exceeds demand
Not applicable

Re: Replace one single character from all columns

Thanku Gysbert.

It is working fine.

Community Browser