Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
axnvazquez
Contributor III
Contributor III

Reply value wich is in the same column

Hi everyone ! I have an excel to import wich have two columns, one of those, have the code and the group and the other column has the description .

Like this :

CODE          DESCRIPTION

EXAMPLE1     abcde

102030             abcde

10424               abcde

EXAMPLE2     skdfslk   

11234               sdkf

32809                lsksj

94385               klajlkfj 

I need to be finish like this :

CODE          DESCRIPTION            CODE_NAME

EXAMPLE1     abcde                    EXAMPLE1    

102030             abcde                    EXAMPLE1    

10424               abcde                    EXAMPLE1    

EXAMPLE2     skdfslk                   EXAMPLE2    

11234               sdkf                    EXAMPLE2    

32809                lsksj                    EXAMPLE2    

94385               klajlkfj                 EXAMPLE2    


I 've already try to use for each like this :


for each a in FieldValueList('B')

LOAD if(WildMatch($(a),'CAPITULO*')>0,$(a)) as Capitulo AutoGenerate 2;

NEXT a

But it doesn't work

1 Solution

Accepted Solutions
felipedl
Partner - Specialist III
Partner - Specialist III

Hi Axel,

Assuming you have the 'Example 1' description as the first row in your table, you could try something like this:

fakedata:

load * Inline

[

  CODE,DESCRIPTION

  102030,abcde

  EXAMPLE1,abcde

  10424,abcde

  EXAMPLE2,skdfslk

  11234,sdkf

  32809, lsksj

  94385,klajlkfj

];

NoConcatenate

Load

  RowNo() as Id,

  CODE,

  DESCRIPTION,

  if (WildMatch(CODE,'EXAMPLE*'),CODE,peek(Teste)) as Teste

Resident fakedata;

drop table fakedata;

Since there's nothing to compare in the columns, I would assume you have some structure that the first row has the defining CODE, in this case 'Example 1'.

Attached the file I used.

Felipe.

View solution in original post

4 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

Hi Axel,

Assuming you have the 'Example 1' description as the first row in your table, you could try something like this:

fakedata:

load * Inline

[

  CODE,DESCRIPTION

  102030,abcde

  EXAMPLE1,abcde

  10424,abcde

  EXAMPLE2,skdfslk

  11234,sdkf

  32809, lsksj

  94385,klajlkfj

];

NoConcatenate

Load

  RowNo() as Id,

  CODE,

  DESCRIPTION,

  if (WildMatch(CODE,'EXAMPLE*'),CODE,peek(Teste)) as Teste

Resident fakedata;

drop table fakedata;

Since there's nothing to compare in the columns, I would assume you have some structure that the first row has the defining CODE, in this case 'Example 1'.

Attached the file I used.

Felipe.

axnvazquez
Contributor III
Contributor III
Author

Wowww Felip !!!!! thank you so much !!! it worksss !


What about this "peek(teste)"  .. what is "teste" ??

felipedl
Partner - Specialist III
Partner - Specialist III

Hi Axel,

It just searches for the previous row in the table and gets the value.

The 'teste' is just the name of the field i've used, so it would look while loading the field 'Teste' for the previous 'Teste' value in the table.

Something like the below table

Sample.png

axnvazquez
Contributor III
Contributor III
Author

Thank you so much !!