Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
zhadrakas
Specialist II
Specialist II

Convert concatenated numbers to num

Hello,

i want to generate a concatenated number out of the following fields.

num(num(Store_ID, '0000')&num(BusinessDay, '000000')&num(cashier, '00')&num(Trans_ID, '0000')))

QlikView doesnt Interpret this as a number.

Is there a trick to get a number out of that?

Thanks in advance for help

Tim

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I think Evaluate() will only create a dual value with the concatenated text value and a numeric value that is an approximation to the integer value, as best as the IEEE representation allows.

If your numbers differ only in least significant digits, QV may not be able to distinguish them, so you may lose information.

Maybe you won't see this with a limited data set, but definitely it may become an issue when you add more digits to your field values.

It may be best to either use just the text value (so you don't need to store the numeric representation that may not be helpful anyway) or use an autonumber instead;

AutonumberHash256( Store_ID,BusinessDay,cashier,Trans_ID) as Key

[in case you want to create a numeric key field based on the four field values]

View solution in original post

17 Replies
Anil_Babu_Samineni

Try this


num(num(Store_ID, '0000')&num(BusinessDay, '000000')&num(cashier, '0000')&num(Trans_ID, '0000')),'0000')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
t_moutault
Contributor III
Contributor III

hi,

have you try to add the format :

num(

num(Store_ID, '0000')&num(BusinessDay, '000000')&num(cashier, '00')&num(Trans_ID, '0000'))

, '0000000000000000')

zhadrakas
Specialist II
Specialist II
Author

doesn't work.

Input: num(Store_ID, '0000')&num(BusinessDay, '000000')&num(cashier, '00')&num(Trans_ID, '0000'))

Output: 155542522041399

Input: num(num(Store_ID, '0000')&num(BusinessDay, '000000')&num(cashier, '00')&num(Trans_ID, '0000')), '00000000000000')

Output: '-'

sunny_talwar

May be this:

Num#(Num(Store_ID, '0000') & Num(BusinessDay, '000000') & Num(cashier, '00') & Num(Trans_ID, '0000'), '0000000000000000')

t_moutault
Contributor III
Contributor III

like this

num(

num(Store_ID, '0000')&num(BusinessDay, '000000')&num(cashier, '00')&num(Trans_ID, '0000')

, '0000000000000000')

zhadrakas
Specialist II
Specialist II
Author

doesn't work either. it Shows the number. but the value is not interpreted as number.

sunny_talwar

I guess the number is greater than 14 digits and QlikView has problem with numbers which are greater than 14 digits

marcus_sommer

If you concatenate numbers with the &-sign you will create a string and not a number. Therefore I think you will need a different approach like:

([StoreID] * pow(10, 4)) + ([OrderID] * pow(10, 9)) + [Pos] as [UniqueKey]

which worked great in my case. If your key isn't necessary between different qvw's or to incremental load from qvd's you could also put your key into an autonumber() function (whereby if you used a string-concatenation of numbers you might need a delimiter like '|' between them to ensure that each key is unique - and no num(x, '0000') is necessary).

- Marcus