csv-parser / program-examples / pr8.cql
pr8.cql
Raw
p = import("P.csv");
q = import("Q.csv");

for pr in p {
    for qr in q {
        if pr[3] == qr[3] {
            col1 = if empty(qr[0]) {pr[0]} else {qr[0]};
            col2 = if empty(qr[1]) {pr[1]} else {qr[1]};
            col3 = if empty(qr[2]) {pr[2]} else {qr[2]};
            out.add(col1, col2, col3, qr[3]);
        }
    }
};