Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Search for blank or 'NA' in rows and return their respective field name else ' ' and concat them with ',' and I have 80 fields and return the output in a new single field.
sample ex-
A:
load*
Inline [
State,GSTIN,MS
ANDHRA PRADESH,345i,52
ASSAM,NA,''
BIHAR,'',3
NA,V1332,''
NA,NA,NA
'','',abc
'',tt,''
d,'',''
];
the output should look like-''
State | GSTIN | MS | a |
abc | State,GSTIN | ||
tt | State,MS | ||
ANDHRA PRADESH | 345i | 52 | |
ASSAM | NA | GSTIN,MS | |
BIHAR | 3 | GSTIN | |
d | GSTIN,MS | ||
NA | NA | NA | State,GSTIN,MS |
NA | V1332 | State,MS |
i would suggest to do these calculation via load script... this works:
A:
Load *,
if(right(a_TMP,1)=',',left(a_TMP,len(a_TMP)-1),a_TMP) as a;
load *,
if(isnull(State) or trim(State)='' or upper(State)='NA','State,')&
if(isnull(GSTIN) or trim(GSTIN)='' or upper(GSTIN)='NA','GSTIN,')&
if(isnull(MS) or trim(MS)='' or upper(MS)='NA','MS') as a_TMP
Inline [
State,GSTIN,MS
ANDHRA PRADESH,345i,52
ASSAM,NA,''
BIHAR,'',3
NA,V1332,''
NA,NA,NA
'','',abc
'',tt,''
d,'',''
];
Drop Field a_TMP;
i would suggest to do these calculation via load script... this works:
A:
Load *,
if(right(a_TMP,1)=',',left(a_TMP,len(a_TMP)-1),a_TMP) as a;
load *,
if(isnull(State) or trim(State)='' or upper(State)='NA','State,')&
if(isnull(GSTIN) or trim(GSTIN)='' or upper(GSTIN)='NA','GSTIN,')&
if(isnull(MS) or trim(MS)='' or upper(MS)='NA','MS') as a_TMP
Inline [
State,GSTIN,MS
ANDHRA PRADESH,345i,52
ASSAM,NA,''
BIHAR,'',3
NA,V1332,''
NA,NA,NA
'','',abc
'',tt,''
d,'',''
];
Drop Field a_TMP;