Hello,
Environment info:
- APEX version: 5.1.1.00.08
- DB version: 11.2.0.2.0
- Architecture: APEX listener
- Browser: Chrome 76.0.3809.132
I need to create file based on logs sent from jenkins. Logs are stored in two tables. One of them has CLOB column and store whole logs from jenkins as a string and another one store parsed logs in bunch of varchar rows.
I display logs live in text area with ajax callback and javascript.
Ajax Callback return JSON:
begin
htp.prn('{"logLines" : "');--beginning of JSON object
for r in(
with nums as(
select rownum r
from dual connect by
rownum <= 10000
), tst_jenkins_job_log2 as(
select logs.id, logs.log_msg, logs.test_run_result_history_id
from tst_jenkins_job_log logs
where logs.test_run_result_history_id = :P404_TEST_RUN_HISTORY_ID
)
select log_msg || '\n' /* linebreak */ log_msg
from tst_jenkins_job_log2
where test_run_result_history_id = :P404_TEST_RUN_HISTORY_ID
order by id desc
)loop
htp.prn(r.log_msg);
end loop;
htp.prn('"}'); --end of JSON object
end;
JavaScript run Ajax Callback:
console.log("invoked");
apex.server.process ( "print_loglines", {
pageItems: "P404_TEST_RUN_HISTORY_ID"
},{
success: function( pData ) {
var logLines = pData.logLines ;
console.log("Data length: " + logLines.length);
$s("P404_LOGS",logLines); //assign returned value to P404_LOGS item
}
});
I would like to prepare two things:
1. Prepare functionality to create and download txt file with value from CLOB column.
2. Preapre functionality to create and download txt file based on existing Ajax Callback.
Do you know what would be the best approach here to achive the goals? Thank you in advance.
BR,
Lukas