Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Group on 3 fields?

How do i group rows when i cant group on one field? the reason is shown underneath, sometimes thers no value in some of the field but the row has a value for exampel phone thats connect it to a nother row there i can find ex. code.

codephonemailX1X2
1313@13.13
13077113
07711313@13.13
13@13.13
1207711212@12.12
1212@12.12
12077112
1616@16.16
16077116
1607711616@16.16
07711616@16.16

The wanted result is:

codephonemailX1X2
1307711313@13.13
1207711212@12.12
1607711616@16.16

Think its a no brainer but i cant get it right. Any ideas?

15 Replies
Gysbert_Wassenaar

In a straight table you can use code as dimension and expressions like maxstring(phone) and maxstring(mail). And enable Suppress When Value is Null for the code dimension.


talk is cheap, supply exceeds demand
Not applicable
Author

Okej, but i want to do it in the load script. Is it possible?

Gysbert_Wassenaar

Something like:

Load code, maxstring(phone) as phone, maxstring(mail) as mail

from ...somewhere...

group by code;


talk is cheap, supply exceeds demand
Not applicable
Author

dose that realy work on:

codephonemailX1X2
13
13077113
07711313@13.13
Gysbert_Wassenaar

Yes, it works perfectly. It does not make any guessed but works with the data given. Nulls stay nulls and are not replaced by random values or values that would result from an algorithm that is not specified.

If it does not do what you want, then you did not specify what should happen.


talk is cheap, supply exceeds demand
Not applicable
Author

My script:

SET NULLINTERPRET=NULL;

  Dev:

  LOAD *

  Inline [

  code, phone, mail,

      '13',NULL,NULL

      '13','077113',NULL

      NULL,'077113','13@13.13'

  ];

  Dev2:

  load

  code

  ,MaxString(phone) as phone

  ,MaxString(mail) as mail

  Resident Dev

  Group By code;

  DROP Table Dev;

Makes:

codephonemailX1X2
13077113
07711313@13.13

My goal:

codephonemailX1X2
1307711313@13.13
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Dev:

  LOAD *

  Inline [

  code, phone, mail,

      '13',NULL,NULL

      '13','077113',NULL

      NULL,'077113','13@13.13'

  ];

  Dev2:

  load

  code

  ,MaxString(phone) as phone

  ,MaxString(mail) as mail

  Resident Dev

WHERE Not IsNull(phone) or Not IsNull(mail)   // This removes Null records

  Group By code;

  DROP Table Dev;

Regards,

Jagan.

qlikpahadi07
Specialist
Specialist

HI Marten,

I have created the Sample App based on your data and applied same logic which gwassenaar had mentioned through UI/Script.

find the attachment

Untitled.png

Not applicable
Author

Outputs

codephonemailX1X2
13077113
07711313@13.13

My goal

codephonemailX1X2
1307711313@13.13