Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
y_vandijk
Contributor
Contributor

MAKE SOME CODE/VALUES AS ONE GROUP

hello'

i have afiled that its name is status_code.

this filed contian alot of codes' for exsamle:KB,KE,KD,G3,G4,G7,X,Z4...

i want to make group/famlies of code.

i need it becasue i have to count them in groups.

i also need to shw the barcodes that got status codes according to the groups/

the filed of the barcode calld Track_No

barcodestatus_code
1234G3
5678KB
9102kd
987z4

G3, Z4 =group1

kb,kd=group2

2 Replies
el_aprendiz111
Specialist
Specialist

Hi,

LOAD * Inline
[
status_code, GRP
KB,GROUP 2
KE,GROUP 2
KD,GROUP 2
G3,GROUP 1
G4,GROUP 1
G7,GROUP 1
X,GROUP 1
Z4,GROUP 1
]
;


LOAD *, ApplyMap('COD',Upper(status_code),'OTHER') AS MY_GROUP;
LOAD * Inline
[
barcode,status_code
1234,G3
5678,KB
9102,kd
987,z4
]
;

EXIT Script;

Ralf_Heukäufer
Partner - Creator III
Partner - Creator III

Hello,

you can use a if clause.

Load

barcode,

status_code,

if(status_code = 'G3' or status_code = 'Z4','Group 1',if(status_code = 'KB' or status_code = 'KD','Group 2')) as Group

from ........;

Exit Script;