# QlikView Documents

Documents for QlikView related information.

Announcements
IMPORTANT: Upcoming LEF Database Maintenance, Oct. 3rd - SEE DETAILS

# Conversion of Binary Numbers to Decimal Numbers in Scripting

MVP & Luminary

## Conversion of Binary Numbers to Decimal Numbers in Scripting

Hi All,

I hope this script helps you when you require to convert Binary numbers to Decimal numbers.

```Table:
GROUP BY Binary;
Alt(Pow(If(Mid(Binary, IterNo(), 1) = 1, 2), Len(Binary)-IterNo()), 0)  AS DecimalValue
While Iterno() <= Length;
Len(Binary) AS Length
Inline [
Binary
1011
10000
00000
11111
000010111101011101111010
10111
0000
00
0
];
```

Hope this helps you.

Regards,

jagan.

Labels (5)

• ### Scripting

MVP

Hi Jagan,

QlikView is very kind here and lets us do it more easily. It's just about number formatting.

 Load            Binary,            num(Num#(Binary, '(Bin)')) as Decimal Inline [ Binary         1011        10000       00000       11111       1011110101      10111       0000       00       0  ];

MVP & Luminary

Hi,

But there is an issue with Binary numbers  with greater than 14 digits, it is getting null.

=num(Num#('111111111111111', '(Bin)'))

Regards,

Jagan.

MVP

tresesco this post by jagan stem from following discussion: Converting binary sequence to decimal

MVP & Luminary

Yes Sunny!!!!  This can deal with any number of Binary digits.

Regards,

jagan.

MVP

Yes, when it goes beyond 14 digits, number formatting fails. . Its a limitation by qv number system that supports only 64-bit IEEE, and

 The 64-bit IEEE float can only show 14 digits

Version history
Revision #:
1 of 1
Last update:
‎2016-01-14 08:31 PM
Updated by: