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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creating a numeric key

Hey Guys.

I have the following table:

Numerator

CostingCode

Invoice No

1

1

AAAA-111

2

1

AAAA-111

3

0

AAAA-111

4

1

AAAA-111

5

0

AAAA-111

6

1

AAAA-111



Now I want that if the CostingCode=0 then the numerator will not appear and the next one will continue from where is stopped.

Now the table will look like this:

Numerator

CostingCode

Invoice No

1

1

AAAA-111

2

1

AAAA-111

-

0

AAAA-111

3

1

AAAA-111

-

0

AAAA-111

4

1

AAAA-111



How can I do it in the script? (I have to do it for every invoice...)

Thanks in advance!!

Montal.

1 Solution

Accepted Solutions
tabletuner
Creator III
Creator III

apply the peek() function in a resident load AFTER the initial load. Sort the table in your initial load.

Also, include a statement like if(peek('invoice')=invoice),.....) because you need to restart if a new invoice appears.

View solution in original post

6 Replies
Not applicable
Author

Hi Montal,

Try this if (CostingCode=0,' -' , Numerator)

Not applicable
Author

Hi XXX.

But then the last Numertaor will be 6 and it needs to be 4...

Not applicable
Author

Hi,

How you are genrating the numerator, it is database value of generated at script level using recno ,row no() functions.

Not applicable
Author

Hi,

Sort the table by Invoice No & Numerator then use below if statment

if(peek(CostingCode)=0,peek(Numerator),Numerator)

Hope this will help you

Thanks & Regards

Not applicable
Author

Hi Upendra ,

I tried your if condition but getting wrong value. Please correct where it is going wrong

[Invoice No],

LOAD

CostingCode,

if(peek(CostingCode)=0,peek(Numerator),Numerator) as Numerator

FROM (ooxml, embedded labels, table is Sheet1) order by [Invoice No],CostingCode asc



Attached the o/p for your reference.

tabletuner
Creator III
Creator III

apply the peek() function in a resident load AFTER the initial load. Sort the table in your initial load.

Also, include a statement like if(peek('invoice')=invoice),.....) because you need to restart if a new invoice appears.