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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
alex59800
Contributor II
Contributor II

For Each next using a field in a file

Hi there,

In need some help using each for ....next.

I have datas in an .xls file with some code in a field called A like this

A

1

2

3

10

99

What i need to do is to create a key with customers number for each of this datas in field a.


An example, i have two customers GEORGES and BEN form a load,

i have my datas in table B which is an xls file and i need to autogenerate keys through a "for each ...next" with this results:

GEORGES1

GEORGES2

GEORGES3

GEORGES10

GEORGES99

BEN1

BEN2

BEN3

BEN10

BEN99

it is possible


thx a lot


Alex

3 Replies
Not applicable

I don't know if you need a more complex numbering scheme, but a load to resident then a concatenation of the name field with recno() should work. For example:

TEST:
Load * inline [
Name,
GEORGE,
BEN,
JIM,
CHARLES,
VICTOR
];

load Name&recno() as key_Field resident TEST;

Not applicable

Hi Dauchy, if I understand correctly what you need is doing some sort of cross product between field A in table x and field B in table y. You can accomplish this using a join between the two tables, I enclosed a sample qlikview application with the results I assume you are expecting.

Regards.

Not applicable

Hi Dauchy,

u can try this

tab1:

LOAD * INLINE [

A

1

2

3

10

99

];

tab2:

LOAD * INLINE [

B

GEORGE

BEN

];

let x=noofrows('tab1');

concatenate (tab1) LOAD B as A resident tab2;

drop table tab2;

let y=noofrows('tab1');

let z=$(x)+1;

for i=$(z) to $(y)

for j=1 to $(x)

load fieldvalue('A',$(i)) as A,fieldvalue('A',$(i))&fieldvalue('A',$(j)) as new resident tab1;

next j

next i

not sure if this is what u want
thanks