Skip to main content
Announcements
Jan 15, Trends 2025! Get expert guidance to thrive post-AI with After AI: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
zarmoton
Creator
Creator

advanced load distinct , on some field

hello

Can you help me to remove some rows in my load script with the following rule:

after different step i have a table like that:

Corisqcodnttnomnom2
A1AAAAAAA
B2BBBBBB
Z1
AAA
A1AAA
Z3
CCC
C4DDD
Z4
D

I would like a script to remove the row

3rd row:    Z   1  -  AAA   => because codntt = 1 exist with a codrisq other than Z

and

Z  4 - D   => because codntt = 4 exist with a corisq other than Z

So at the end , i like to have a reduce table like that:

Corisqcodnttnomnom2
A1AAAAAAA
B2BBBBBB
A1AAA
Z3CCC
C4DDD

Notice:

As you can see , i keep Z  3 - CCC, because does not exist with another corisq other than Z

As you can see , Z  1 - AAA need to be remove, but the 2 rows with corisq = A and codntt = 1 should be kept.

thk you for your help.

Regards

1 Solution

Accepted Solutions
Not applicable

I think you want a more general script.

Find attached !

View solution in original post

4 Replies
Not applicable

I believe this would help:

table:

LOAD Corisq,

          cordntt,

          nom,

          nom2

Resident [source table]

Where Corisq<>'Z';

Concatenate(table)

LOAD Corisq,

          cordntt,

          nom,

          nom2

Resident [source table]

Where Corisq='Z' AND not Exists(cordntt);

jeffmartins
Partner - Creator II
Partner - Creator II

Hi zarmoton,

You can try the following code:

LOAD Corisq,

          codntt,

          nom,

          nom2

FROM [Data.xlsx] (ooxml, embedded labels, table is Plan1)

Where not (codntt = 1 and Corisq = 'Z')

    and not (codntt = 4 and Corisq = 'Z')

   ;

Hope this helps you.

Regards

Not applicable

I think you want a more general script.

Find attached !

zarmoton
Creator
Creator
Author

excellent !

Thk you for your answer.

Very nice.