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.
surynnchin
New Contributor III

Store value as Num

Hi Community

I have account no as below, how to make the account no '979987980000000' become a number, all the account no aligned to the right?

Num.PNG.png

1 Solution

Accepted Solutions
Employee
Employee

Re: Store value as Num

But if it is an account number, it would be better to treat it as a unique key instead of as a number. I would instead remove the numeric interpretation by wrapping it in the Text() function:

     Text(AccountNo) as AccountNo

HIC

10 Replies
MVP
MVP

Re: Store value as Num

QlikView supports a maximum of 14 digits in your number. If it is longer than that,  it will be interpreted a a text.

First, you can use evaluate() to convert your original text into a integer.Then, you can use NUM to format it appropriately


Try Below

num( EVALUATE(YourFieldName),'#0') AS YourFieldName

er_mohit
Honored Contributor II

Re: Store value as Num

Try this

Evaluate(AccountNo) as N,

Employee
Employee

Re: Store value as Num

But if it is an account number, it would be better to treat it as a unique key instead of as a number. I would instead remove the numeric interpretation by wrapping it in the Text() function:

     Text(AccountNo) as AccountNo

HIC

MVP
MVP

Re: Store value as Num

Hi,

Try Num(), otherwise you can align all the values to the right by changing

Properties -> Presentation -> Alignment -> Text and Numbers to Right

Hope this helps you.

Regards,

Jagan.

sunilkumarqv
Valued Contributor II

Re: Store value as Num

Hi SurynnChin,

Its easy on presentation tab make alignment as right .

Hope i got your solution

surynnchin
New Contributor III

Re: Store value as Num

Can you elaborate more? Is there any advantage to store the account number as a text instead of num?

Not applicable

Re: Store value as Num

hi

try this

since NumFormat has capacity to display 14 digit number. more than 14 digit number show in text.

for this use it.

Evaluate(AccountNo) as AccountNo_new


Employee
Employee

Re: Store value as Num

I assume that AccountNo is an ID that you will use only as a key or selection field, and that you will never make any arithmetic calculations with it. If so, there are no longer any major advantages with having it as a number. (Except that a number takes less space in RAM than a string.)

Further, you have an account number that cannot be represented exactly as a number. You can use Evaluate() to assign a numeric value to it, but you will lose information. For instance, the following two account numbers will be assigned the same numeric value:

   979987980000000000

   979987980000000001

So, the advantage with storing it as text, is that you don't lose any information: The two account numbers above will still be two separate account numbers.

HIC

ashwanin
Valued Contributor

Re: Store value as Num

use text(AccountNo) as AccountNo

Community Browser