Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

How to a string field with () designating negative into a num type?

Hi community,

Is there a simple way or does anyone have anyway to turn negative strings with () into -.

example of field data:

      9056

    11209

(495)

(44245)

    49300

14 Replies

Re: How to a string field with () designating negative into a num type?

You have to change the Format Pattern on the Number tab:

Capture.PNG

For example, change ###########,### to ###########,###;-###########,### for a -

or change ###########,### to ###########,###;(###########,###) for ()

nstefaniuk
Contributor III

Re: How to a string field with () designating negative into a num type?

Hi you can use:

Num#(replace(replace('(14)', '(', '-'), ')', ''))

Put your field instead of '(14)' in the formula.

Not applicable

Re: How to a string field with () designating negative into a num type?

That is exactly what I had done but it still gives me text data type.  I go from:

(4302)

    5069

    7869

to:

-4302

   5069

   7869

nstefaniuk
Contributor III

Re: How to a string field with () designating negative into a num type?

When you say "text data" you mean the display in a chart is the display used for text ?

nstefaniuk
Contributor III

Re: How to a string field with () designating negative into a num type?

In my test it works.

Please find below

Not applicable

Re: How to a string field with () designating negative into a num type?

I'm not sure what type the data is, but in a list box it aligns the way text data is supposed to. Other numbers align to the right.

Not applicable

Re: How to a string field with () designating negative into a num type?

Here's my document

nstefaniuk
Contributor III

Re: How to a string field with () designating negative into a num type?

Ok got it.

Remove the "," too when you replace the "( )".

Not applicable

Re: How to a string field with () designating negative into a num type?

Sorry can you show me the correct code.  I don't see an extra ,

Community Browser