");
output.writeStartElement("session");
output.writeAttribute("samples", "1");
output.writeAttribute("formtype", "T1");
output.writeStartElement("grader");
output.writeCDATA(grader.text);
output.writeEndElement();
output.writeStartElement("form");
var aromaScale = findChildObject(form.elementAt(i), 'aroma');
output.writeStartElement("attribute");
output.writeAttribute("name", "aroma");
output.writeAttribute("initial", aromaScale.initialValue);
var aromaBox = findChildObject(form.elementAt(i), 'aromabox');
output.writeAttribute("value", aromaBox.cleanText);
output.writeEmptyElement("qualifier");
output.writeAttribute("name", "dry");
var dryScale = findChildObject(form.elementAt(i), 'dry');
output.writeAttribute("value", dryScale.value);
output.writeEmptyElement("qualifier");
var breakScale = findChildObject(form.elementAt(i), 'break');
output.writeAttribute("name", "break");
output.writeAttribute("value", breakScale.value);
output.writeStartElement("notes");
var aromaNotes = findChildObject(form.elementAt(i), 'aromanotes');
output.writeCDATA(aromaNotes.plainText);
output.writeEndElement();
output.writeEndElement();
output.writeStartElement("attribute");
output.writeAttribute("name", "flavor");
var flavorScale = findChildObject(form.elementAt(i), 'flavor');
output.writeAttribute("initial", flavorScale.initialValue);
var flavorBox = findChildObject(form.elementAt(i), 'flavorbox');
output.writeAttribute("value", flavorBox.cleanText);
output.writeEndElement();
output.writeStartElement("attribute");
output.writeAttribute("name", "acidity");
var acidityScale = findChildObject(form.elementAt(i), 'acidity');
output.writeAttribute("initial", acidityScale.initialValue);
var acidityBox = findChildObject(form.elementAt(i), 'aciditybox');
output.writeAttribute("value", acidityBox.cleanText);
output.writeStartElement("qualifier");
output.writeAttribute("name", "intensity");
var intensityScale = findChildObject(form.elementAt(i), 'acidityintensity');
output.writeAttribute("value", intensityScale.value);
output.writeEndElement();
output.writeStartElement("notes");
var acidityNotes = findChildObject(form.elementAt(i), 'aciditynotes');
output.writeCDATA(acidityNotes.plainText);
output.writeEndElement();
output.writeEndElement();
output.writeStartElement("attribute");
output.writeAttribute("name", "body");
var bodyScale = findChildObject(form.elementAt(i), 'body');
output.writeAttribute("initial", bodyScale.initialValue);
var bodyBox = findChildObject(form.elementAt(i), 'bodybox');
output.writeAttribute("value", bodyBox.cleanText);
output.writeStartElement("qualifier");
output.writeAttribute("name", "level");
var levelScale = findChildObject(form.elementAt(i), 'bodylevel');
output.writeAttribute("value", levelScale.value);
output.writeEndElement();
output.writeStartElement("notes");
var bodyNotes = findChildObject(form.elementAt(i), 'bodynotes');
output.writeCDATA(bodyNotes.plainText);
output.writeEndElement();
output.writeEndElement();
output.writeStartElement("attribute");
output.writeAttribute("name", "balance");
var balanceScale = findChildObject(form.elementAt(i), 'balance');
output.writeAttribute("initial", balanceScale.initialValue);
var balanceBox = findChildObject(form.elementAt(i), 'balancebox');
output.writeAttribute("value", balanceBox.cleanText);
output.writeStartElement("notes")
var balanceNotes = findChildObject(form.elementAt(i), 'balancenotes');
output.writeCDATA(balanceNotes.plainText);
output.writeEndElement();
output.writeEndElement();
output.writeStartElement("attribute");
output.writeAttribute("name", "aftertaste");
var aftertasteScale = findChildObject(form.elementAt(i), 'aftertaste');
output.writeAttribute("initial", aftertasteScale.initialValue);
var aftertasteBox = findChildObject(form.elementAt(i), 'aftertastebox');
output.writeAttribute("value", aftertasteBox.cleanText);
output.writeStartElement("notes");
var aftertasteNotes = findChildObject(form.elementAt(i), 'aftertastenotes');
output.writeCDATA(aftertasteNotes.plainText);
output.writeEndElement();
output.writeEndElement();
output.writeStartElement("attribute");
output.writeAttribute("name", "overall");
var overallScale = findChildObject(form.elementAt(i), 'overall');
output.writeAttribute("initial", overallScale.initialValue);
var overallBox = findChildObject(form.elementAt(i), 'overallbox');
output.writeAttribute("value", overallBox.cleanText);
output.writeEndElement();
output.writeStartElement("attribute");
output.writeAttribute("name", "uniformity");
var uniformityBox = findChildObject(form.elementAt(i), 'uniformity');
output.writeAttribute("value", uniformityBox.cleanText);
output.writeStartElement("notes");
var uniformityNotes = findChildObject(form.elementAt(i), 'uniformityNotes');
output.writeCDATA(uniformityNotes.plainText);
output.writeEndElement();
output.writeEndElement();
output.writeStartElement("attribute");
output.writeAttribute("name", "cleancup");
var cleancupBox = findChildObject(form.elementAt(i), 'cleancup');
output.writeAttribute("value", cleancupBox.cleanText);
output.writeEndElement();
output.writeStartElement("attribute");
output.writeAttribute("name", "sweetness");
var sweetnessBox = findChildObject(form.elementAt(i), 'sweetness');
output.writeAttribute("value", sweetnessBox.cleanText);
output.writeEndElement();
output.writeStartElement("attribute");
output.writeAttribute("name", "total");
var totalBox = findChildObject(form.elementAt(i), 'totalscore');
output.writeAttribute("value", totalBox.cleanText);
output.writeEndElement();
output.writeStartElement("attribute");
output.writeAttribute("name", "taints");
var taintBox = findChildObject(form.elementAt(i), 'taints');
output.writeAttribute("value", taintBox.cleanText);
output.writeEndElement();
output.writeStartElement("attribute");
output.writeAttribute("name", "faults");
var faultBox = findChildObject(form.elementAt(i), 'faults');
output.writeAttribute("value", faultBox.cleanText);
output.writeEndElement();
output.writeStartElement("attribute");
output.writeAttribute("name", "final");
var finalBox = findChildObject(form.elementAt(i), 'finalscore');
output.writeAttribute("value", finalBox.cleanText);
output.writeEndElement();
output.writeStartElement("attribute");
output.writeAttribute("name", "sample");
output.writeAttribute("value", sampleBox.text);
output.writeEndElement();
output.writeStartElement("notes");
var sampleNotes = findChildObject(form.elementAt(i), 'notes');
output.writeCDATA(sampleNotes.plainText);
output.writeEndElement();
output.writeEndElement();
output.writeEndElement();
output.writeEndDocument();
var q = "INSERT INTO cuppingform_t1 VALUES(:session, :sample, :position, :grader, :finalscore, :notes, :serialization, :aroma, :flavor, :aftertaste, :acidity, :body, :uniformity, :balance, :cleancup, :sweetness, :overall, :total)";
var query = new QSqlQuery;
query.prepare(q);
query.bind(":session", Number(session.text));
query.bind(":sample", sampleBox.text);
query.bind(":position", i + 1);
query.bind(":grader", grader.text);
query.bind(":finalscore", Number(finalBox.cleanText));
query.bind(":notes", sampleNotes.plainText);
query.bindDeviceData(":serialization", outfile);
query.bind(":aroma", Number(aromaBox.cleanText));
query.bind(":flavor", Number(flavorBox.cleanText));
query.bind(":aftertaste", Number(aftertasteBox.cleanText));
query.bind(":acidity", Number(acidityBox.cleanText));
query.bind(":body", Number(bodyBox.cleanText));
query.bind(":uniformity", Number(uniformityBox.cleanText));
query.bind(":balance", Number(balanceBox.cleanText));
query.bind(":cleancup", Number(cleancupBox.cleanText));
query.bind(":sweetness", Number(sweetnessBox.cleanText));
query.bind(":overall", Number(overallBox.cleanText));
query.bind(":total", Number(totalBox.cleanText));
query.exec();
}
window.close();
});
]]>