Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I have a scenario to check the field whether the name exists for the ID and present it in the column
ID | ENTITY | TATA | ESSILOR | IBM | BOSCH |
AAA | TATA | 0 | 1 | 1 | 0 |
AAA | ESSILOR | 1 | 0 | 1 | 0 |
AAA | IBM | 1 | 1 | 0 | 0 |
BB | TATA | 0 | 1 | 1 | 1 |
BB | ESSILOR | 1 | 0 | 1 | 1 |
BB | IBM | 1 | 1 | 0 | 1 |
BB | BOSCH | 1 | 1 | 1 | 0 |
the above table is grouped by ID and ENTITY and I need to find whether the ID can be transferred to other entities
Ideally I am looking for the above table
Thanks thats exactly what I want.
check this
Source_Data:
LOAD * INLINE [
ID, T1
1, A
2, B
3, C
4, D
5, E
];
Result:
Load ID,
T1,
Previous(T1) as T2
Resident Source_Data;
drop table Source_Data;
I need the same output as shown on the image
Thanks
please share your source data.
Then i can help you.
Regards
Tim
How does your raw data or script looks like?
Please also post that
Available script or data will be helpful.
Hi,
I have done a script who shows the exact flag result.
test:
load * Inline [
ID, ENTITY
AAA, TATA
AAA, ESSILOR
AAA, IBM
BB, TATA
BB, ESSILOR
BB, IBM
BB, BOSCH
]
;
T1:
LOAD Concat(ENTITY,' ') as Check,
ID
Resident test
GROUP BY ID ;
LEFT JOIN( test)
LOAD *
Resident T1;
drop table T1;
Table_Flag:
LOAD ID,
ENTITY,
if(SubStringCount(Check,'TATA')=0 OR ENTITY='TATA',0,1) as TATA,
if(SubStringCount(Check,'ESSILOR')=0 OR ENTITY='ESSILOR',0,1) as ESSILOR,
if(SubStringCount(Check,'IBM')=0 OR ENTITY='IBM',0,1) as IBM,
if(SubStringCount(Check,'BOSCH')=0 OR ENTITY='BOSCH',0,1) as BOSCH
Resident test;
DROP Table test;
Best regards,
Cosmina
Hope this helps
Thanks thats exactly what I want.