Which IIQ version are you inquiring about?
8.4
Have business requirement to automate the export of report results in CSV format to a file location to be used in an ftp process.
I have not found any OOTB option for IIQ. Any recommendations?
you can write a rule which exports the data to a specific path and use the run rule task to schedule the rule as often as u need.
Good idea. do you have an example rule?
i dont have these should get you started Run Rule
the rule rule task I already have and use. what I would need is the export to file rule code.
oh that part is straight forward.
you can standard java to export to file path
public static void writeCsv(Path target, String[] header, List<String[]> rows) throws IOException {
try (BufferedWriter writer = Files.newBufferedWriter(
target,
StandardCharsets.UTF_8,
StandardOpenOption.CREATE,
StandardOpenOption.TRUNCATE_EXISTING,
StandardOpenOption.WRITE)) {
writer.write(toCsvLine(header));
writer.newLine();
for (String[] row : rows) {
writer.write(toCsvLine(row));
writer.newLine();
}
}
}
private static String toCsvLine(String[] values) {
return String.join(",", Arrays.stream(values)
.map(NetworkCsvWriter::escape)
.toArray(String[]::new));
}
private static String escape(String value) {
if (value == null) return "";
boolean needsQuotes = value.contains(",") || value.contains("\"")
|| value.contains("\n") || value.contains("\r");
String escaped = value.replace("\"", "\"\"");
return needsQuotes ? "\"" + escaped + "\"" : escaped;
}
public static void main(String[] args) {
// Windows UNC path (note the escaped backslashes)
Path target = Paths.get("\\\\fileserver\\shared\\reports\\output.csv");
// Linux/macOS mounted share, for example:
// Path target = Paths.get("/mnt/shared/reports/output.csv");
String[] header = {"id", "name", "email"};
List<String[]> rows = List.of(
new String[]{"1", "Alice", "alice@example.com"},
new String[]{"2", "Bob, Jr.", "bob@example.com"}
);
try {
writeCsv(target, header, rows);
System.out.println("CSV written to " + target);
} catch (IOException e) {
System.err.println("Failed to write CSV: " + e.getMessage());
}
}
Doing run rule task has another advantage if this is heavy report. It won’t be stored on db which stores reports in both pdf and csv versions.
Also I have seen more performance improvements when I used SQL to fetch the data required for reports instead of doing search using context method (getobjects or search )