Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

String functions

I'm having data in this format

VC4

VC4-4c

VC4-16c

VC4-64c

but i want in this format

VC4c4

VC4c16

VC4c64

VC4c256

Please help

8 Replies
sudeepkm
Valued Contributor III

Re: String functions

Please take a look at the attachment.

Re: String functions

Use Replace Function in your script..

Load

     Replace(YourFieldName,'-','') as YourFieldName

From TableName;

Not applicable

Re: String functions

replace (Field,'-','') as NewField

regards,

MT

sunilkumarqv
Valued Contributor II

Re: String functions

Hi Shehal,


You can use Purgechar function anything that has to be take it off in your script '-'

so try like these

=purgechar ( Youfieldname,'-' )


For replace function works like below it good to use purgechar for best  optimization

replace('abccde','cc','xyz') returns 'abxyzde'

Not applicable

Re: String functions

but i dnt Vc44c i want Vc4c4 in this way others also

Not applicable

Re: String functions

Can you please elaborate a little bit more. The above example is different from your original example.

Can you create a table and put the two fields side by side with like 5,6 records as to how you want the result to be.

jsaradhi
Valued Contributor

Re: String functions

use

if(index(ddd,'-')>0, subfield(ddd,'-',1)&right(subfield(ddd,'-',2),1)&left(subfield(ddd,'-',2),len(subfield(ddd,'-',2))-1),ddd) as d2

in your load statement in the example qvw above.

test-string.png

Re: String functions

Hi Snehal Mejari,

You have write following expression in your script,

Subfield(Data,'-',1)&''&PurgeChar(SubField(Data,'-',2),'1234567890')&''&KeepChar(SubField(Data,'-',2),'1234567890')*4 as newData

Which give you required as you want .

For better understanding i am attaching sample QVW

Check this It will help you,

Regards

Regards,
Prashant Sangle
Community Browser