Discussion:
Generating Stastics report
(too old to reply)
Anne Raghu
2017-07-03 09:49:04 UTC
Permalink
Raw Message
I am trying to generate a stats report from AD like number of enabled and disabled users based on location.

I am able to store all the stats into a HashMap dynamically. But I am not able to dynamically assign this hashMap data to csv fileConnector.

if(!statsMap.containsKey(country))
{
statsMap.put(country,1);
}
else{
var count = statsMap.get(country);
count = count + 1;
statsMap.remove(country);
statsMap.put(country,count++ );
}


Please help me how can I accomplish this using same procedure or different.
Eddie Hartman
2017-07-04 07:36:16 UTC
Permalink
Raw Message
Post by Anne Raghu
I am trying to generate a stats report from AD like number of enabled and disabled users based on location.
I am able to store all the stats into a HashMap dynamically. But I am not able to dynamically assign this hashMap data to csv fileConnector.
if(!statsMap.containsKey(country))
{
statsMap.put(country,1);
}
else{
var count = statsMap.get(country);
count = count + 1;
statsMap.remove(country);
statsMap.put(country,count++ );
}
Please help me how can I accomplish this using same procedure or different.
Why not write the file directly? For example from the After Close or On Success Hook of your AL. The CSV Parser is really only an advantage when you need to handle output that includes the separator (quoting)
---
keys = statsMap.keySet().toArray();
java.util.Arrays.sort(keys);
title = [];
for (k in keys) {
title.push(k);
}

data = [];
for (k in keys) {
data.push(statsMap.get(k));
}

f = system.openFileForInput("StatMap.csv");
f.write(title.join(";"));
f.newLine();
f.write(data.join(";"));
f.newLine();
f.close();
----
Or am I missing something in your question?
RaNa
2017-07-05 05:23:58 UTC
Permalink
Raw Message
Hi Eddie,

Thanks a lot, I am looking exactly for this.

Loading...