Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
brunosantos
Contributor II
Contributor II

Field Values to several Fields

Hi there.

I've been search the Qlik Community, but I cannot seem to find what I want, and probably it's just a matter of choosing the correct keys words. Anyway here goes.

I have a table with subject, test and result, for example:

subjecttestresult
atest1ok
atest2ok
atest3nok
btest1nok
btest2ok
btest3nok

 

And I want to show for each type of test (values from field test) the corresponding result (ok/nok) according to subject, so something like this:

subjecttest1test2test3
aokoknok
bnokoknok

 

The closest I've been is with pivot table, but cannot seem to workout the expression to fit the needs (just don't know).

I believe this should be pretty straight forward, or? Any help?

Thanks,

Bruno Santos

1 Solution

Accepted Solutions
Taoufiq_Zarra

One Solution with Generic Load

 

DATA:
 
LOAD * INLINE [
    subject, test, result
    a, test1, ok
    a, test2, ok
    a, test3, nok
    b, test1, nok
    b, test2, ok
    b, test3, nok
];
CombinedGenericTable:

Load distinct subject resident DATA;

Tmp:
generic load * resident DATA;

drop table DATA;

FOR i = NoOfTables()-1 to 0 STEP -1

  LET vTable=TableName($(i));
  //trace $(i) - '$(vTable)';
  IF WildMatch('$(vTable)', 'Tmp.*') THEN 

  LEFT JOIN ([CombinedGenericTable]) LOAD distinct * RESIDENT [$(vTable)];

  DROP TABLE [$(vTable)];

  ENDIF 

NEXT i

 

output :

Taoufiq_ZARRA_0-1592932532848.png

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

2 Replies
Taoufiq_Zarra

One Solution with Generic Load

 

DATA:
 
LOAD * INLINE [
    subject, test, result
    a, test1, ok
    a, test2, ok
    a, test3, nok
    b, test1, nok
    b, test2, ok
    b, test3, nok
];
CombinedGenericTable:

Load distinct subject resident DATA;

Tmp:
generic load * resident DATA;

drop table DATA;

FOR i = NoOfTables()-1 to 0 STEP -1

  LET vTable=TableName($(i));
  //trace $(i) - '$(vTable)';
  IF WildMatch('$(vTable)', 'Tmp.*') THEN 

  LEFT JOIN ([CombinedGenericTable]) LOAD distinct * RESIDENT [$(vTable)];

  DROP TABLE [$(vTable)];

  ENDIF 

NEXT i

 

output :

Taoufiq_ZARRA_0-1592932532848.png

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
brunosantos
Contributor II
Contributor II
Author

Thank you @Taoufiq_Zarra . That is exactly what I need.

And searching a little about Generic Load I've found this post from @hic with further explanation.

Once again thanks.

Regards,

Bruno Santos