Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Applicable88
Creator III
Creator III

Adding a calculated field with always the same prefix

Hello,

I have a column with 4 digit shelf ID's. So the ID's looks like this:  1111,2222,1234

Unfortunately another table I want to connect it with always generate this 4-digit number with a prefix like this: (9999)1111, (9999)2222, (9999)1234......

Shelf ID  Shelf ID Report
1111  (9999)1111
2222  (9999)2222
1234  (9999)1234

 

So of course I cannot find any intersection. My initial Idea is to add a "calculated field". I hope someone can provide me with the right expression to do that. 

Thanks in advance!

 

2 Solutions

Accepted Solutions
Taoufiq_Zarra

@Applicable88 

when loading the initial table, you change the line

load

....

[Shelf ID]

FROM ...

 

by

 

load

...

 '(9999)'&[Shelf ID] as [Shelf ID]

From ...

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

Taoufiq_Zarra

it's the same

for example if I have this loading script :

Data:
load Num(Num#([Shelf ID Report],'(9999)###0')) as New_ShelfIDReport,* inline [
Shelf ID Report
(9999)1111
(9999)2222
(9999)1234
];

 

 

output :

Capture.JPG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

5 Replies
Taoufiq_Zarra

@Applicable88 

when loading the initial table, you change the line

load

....

[Shelf ID]

FROM ...

 

by

 

load

...

 '(9999)'&[Shelf ID] as [Shelf ID]

From ...

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Applicable88
Creator III
Creator III
Author

Thank you @Taoufiq_Zarra ,

how to write when I instead get the (9999) out of the other table? 

Like (9999)1111 to get 1111 only

Thanks again.

Taoufiq_Zarra

@Applicable88 

If I understood correctly u can for example use :

=Num(Num#('(9999)1111','(9999)###0'))

 

Taoufiq_ZARRA_0-1591191427047.png

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Applicable88
Creator III
Creator III
Author

Hi @Taoufiq_Zarra ,

in your example I only turn (9999)1111 into 1111 ONCE

I want something like your first example '(9999)'&[Shelf ID] as [Shelf ID].

But instead of I want all numbers in that column (9999)XXXX becomes like XXXX. 

Return ALL numbers in format (9999)#### like ####

This way I can put in data load script or calculate field. 

Thanks. 

Taoufiq_Zarra

it's the same

for example if I have this loading script :

Data:
load Num(Num#([Shelf ID Report],'(9999)###0')) as New_ShelfIDReport,* inline [
Shelf ID Report
(9999)1111
(9999)2222
(9999)1234
];

 

 

output :

Capture.JPG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉