Hi,
I am attempting to normalize some data, and am finding an issue I can’t seem to get around.
I am not doing anything overly complicated. Basically I would like the following to happen:
I would like to normalise lines like this -
1000|admin - service - query - status|matty
2000|domain - user - group|frank
To this -
1000,admin,matty
1000,service,matty
1000,query,matty
1000,status,matty
2000,domain,frank
2000,user,frank
2000,group,frank
But this isn’t happening. My count seems to be working (there are different numbers of attributes in each field I have ‘split’), as it returns the correct number of attributes for each field. But it doesn’t seem to be clearing the list. So, I end up with this…
1000,admin,matty
1000,service,matty
1000,query,matty
1000,status,matty
2000,admin,frank
2000,service,frank
2000,query,frank
And strangely, the example normaliser does the exact same thing!
I have tried to work out how to clean the list variable, ‘usg’, but can’t get that to work…
Any help would be much appreciated!!
Here is my code…
list usg;
function transform(idx) {
usg = split($usg,"\\s*-\\s*");
$0.usg := usg[idx];
$0.user_login := $0.user_login;
$0.name := $0.name;
$0.sec_level := $0.sec_level;
$0.sql_access := $0.sql_access;
$0.application := $0.application;
$0.psid := $0.psid;
}
function count() {
return $usgcount;
}
And these are snippets of my clean attempts. Neither have worked as a list won’t take an integer or string value… This may not be the solution anyhow…
function clean() {
usg='';
}
and integer
function clean() {
usg=0;
}
Thanks!