I have a list of column name. These are different columns that are in different tables in my environment. What i want to create is a dictionary which has key has column and value as list of table name that contains that column.
Is there an easy way to achieve it in KDB ?
I am trying to do something like below:-
colDict:()!()
CheckColInTables:{[tab;col] colPresent:0b;
colPresent:(col in cols tab);
$[ colPresent & (not col in key colDict ); colDict[col]: enlist tab; colDict[col]:colDict[col],enlist ab]; :colDict; };
GetColTabMapping:{[uniqueCols;tableList]
{ tab:x; colDict::CheckColInTables[tab;] each uniqueCols; } each tableList;
};
It seems that uniqueCols that i pass inside subfunction which calls CheckColInTables and updates colDict complains about not knowing uniqueCols. I tried to assign uniqueCols to a variable inside GetColTabMapping and then use that variable inside but that does not work either.