Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Script or Macro?

Hello All,

I've been trying to figure out how to do this. I'm finding bits and peices from other posts, from QV help, etc, but have not yet determined 1) if it's possible in QV, and 2) if it should be done in the script, or in a macro. I'm not a real programmer, but can understand one that is written, and use general coding ideas and methods to make other applications work....

Here is the problem:

Table 1: Order, Part, and Quantity Information

Order# Part# QtyOrder

AAAA 1111 10

AAAA 2222 5

AAAA 3333 2

BBBB 1111 10

BBBB 2222 5

BBBB 3333 1

Table 2: On Hand Inventory Information

Part# QtyOnHand

1111 15

2222 5

3333 1

I want to evaluate the first order, order AAAA and see if ALL lines in that order can be filled. In the example above, line 3 of order AAAA (part 3333) can not be filled, since the order quantity is 2, and the on hand inventory level is 1. So, since a line in order AAAA can not be filled, I do not want to decrement any of the parts for that order from the on hand inventory table.

The second order, order BBBB should then be able to be filled completely, since the on hand inventory is still available and part 3333 in order BBBB is only for 1 units, which is on hand at the time that order would be evaluated.


1) Possible?

2) Do this in the script or in a macro?

3) Any code commands or ideas to point me in the right direction?

My general thoughts would be (not in programming ease...)

50 Set i = 0

75 Let i = i + 1

Can line 1 be filled? Yes, GoTo 100. No, go to next order and start at line 1.

100 if i = (count of lines in order) goto 200

GoTo 75

200 Decrement on hand inventory levels for each line item since all lines can be filled, then start evaluating the next order

Any help would be greatly appreciated!

Kind regards,


Tags (3)
2 Replies
Not applicable

Script or Macro?

Hi ,

are you looking for the same as attached file?


Not applicable

Script or Macro?

Hello Rahul,

Thank you very much for taking a look at this issue. What you have displayed is not the end goal however.

We are trying to fill only orders which can have all of their lines filled. So, since order AAAA can not have one of it's lines filled, we will not allocate inventory to any of the lines in order AAAA.

If an entire order can be completely filled, we will then decrease the value of on hand inventory for the parts in that order accordingly (if all order lines can be completely filled).

Thank you again for taking a look at this!

Kind regards,


Community Browser