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

variable in a field

Hi All,

do you know if this is possible:

I have two tables:

TabA:

No.     Value

1          100

2          300

3          200

TabB:

a

100

20

-50

200

100

-50

I want to load TabB with peek function related to tab A, but i need to use loop as well so that whenever the value goes below 0 it will give me the next n value from TabA.

TabB:

a               b

100            100      =peek(Value, 0, 'TabA')

20              100      =peek(Value, 0, 'TabA')

-50             300      =peek(Value, 1, 'TabA') 

200            300      =peek(Value, 1, 'TabA')

100            300      =peek(Value, 1, 'TabA')

-50             200      =peek(Value, 2, 'TabA')

How to do that?

Many thanks for help.

3 Replies
sushil353
Master II
Master II

Hi,

Can you explain the logic to link field a and b

TabB:

a               b

100            100      =peek(Value, 0, 'TabA')

20              100      =peek(Value, 0, 'TabA') -- ??

-50             300      =peek(Value, 1, 'TabA') -- ??

200            300      =peek(Value, 1, 'TabA') -- ??

100            300      =peek(Value, 1, 'TabA') -- ??

-50             200      =peek(Value, 2, 'TabA') -- ??

martinpohl
Partner - Master
Partner - Master

why don't you use applymap?

Map:

mapping load

Value,

No.

from TabA;

TabB.

load

a,

b,

applymap('Map',b,b) as No

from TabB;

Regards

Not applicable
Author

That will not map correctly. It needs to have a logic to give the next value from tab A when the next value below 0 is met.