Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Convert hex to decimal

Hi

Is it possible to convert a hex value to decimal ?

What I am trying to do is first to extract the value of a Windows registry key using:

GetRegistryString(HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation, ActiveTimeBias)

This registry key contains the current time bias in minutes from UTC, which I then want to use to display times stored as UTC but then converted to local time.

Best Regards,     Bill

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Yes you can, like below example.

=Num(Num#('C7','(HEX)'))  // this will give you 199 which is decimal equivalent of hexadecimal C7.

Therefore, replace C7 with your hexadecimal number to get equivalent decimal.

View solution in original post

4 Replies
tresesco
MVP
MVP

Yes you can, like below example.

=Num(Num#('C7','(HEX)'))  // this will give you 199 which is decimal equivalent of hexadecimal C7.

Therefore, replace C7 with your hexadecimal number to get equivalent decimal.

Anonymous
Not applicable
Author

Tresesco

Sorry it has taken me a while to check out your answer, which answers my question re converting a hex value to decimal perfectly - so I have marked it as correct.

Unfortunately it appears that the value returned from the registry is ffffffc4 which should return a value of -60 using two's compliment as a signed number representation.....

............... I need to do some more thinking about this............ unless someone has a cunning suggestion.

Best Regards,     Bill

monkrupa
Partner - Contributor
Partner - Contributor

Hi, I can see it is an old post, but maybe I will be lucky  and you have the solution for decoding hec to decima woth two's compliment? I am currently struggling with that in Qlik Sense. 

 

BR

Monika

Grolmag
Contributor
Contributor

I made a report on QlikView licenses for myself using the file CalData.pgo.xml

and I ran into a non - critical problem of converting hex to date .. but without this transformation, the report would not be complete🤔. ‌‌ (LastUsed, ToBeDeleted)
In general, I was looking for it, but I didn't find anything useful right away, except for converting 13x hex to excel.

Excell  hex to dateExcell hex to date

 But in the file CalData.pgo.xml the date is set in 16 digits, not 13.. I did not understand how to adapt the excel formula for 16 digits, but I realized that it is possible to trim a 16-bit hex to 13 digits. and it seems that nothing significant is lost at the same time

🙃

it works perfectly
=date((num(Num#(right([PerDocumentCalData/NamedCalsAllocated/CalAllocEntry.LastUsed],13),'(HEX)') )*pow(16,-13)+1)*Pow(2,15),'DD.MM.YYYY hh:mm')