//---------------------------------------- int32_t CBratProcessExportAscii::WriteData() { int32_t result = BRATHL_SUCCESS; //CTrace *p = CTrace::GetInstance(); //p->Tracer(1, "Writing data ..."); CObArray::iterator itDataSet; CRecordSet* recordSet = NULL; CDataSet* dataSet = m_product->GetDataSet(); for (itDataSet = dataSet->begin(); itDataSet != dataSet->end() ; itDataSet++) { recordSet = dataSet->GetRecordSet(itDataSet); ///bool firstRecord = (record == dataSet->front()); CExpressionValue exprValueSelect; if (m_alwaysTrue == false) { recordSet->ExecuteExpression(m_select, m_recordName, exprValueSelect, m_product); } if (m_writeHeader) { for (uint32_t indexExpr = 0 ; indexExpr < m_fields.size() ; indexExpr++) { CExpressionValue exprValueData; recordSet->ExecuteExpression(m_fields[indexExpr], m_recordName, exprValueData, m_product); string colName = (m_names[indexExpr].empty() ? m_fields[indexExpr].AsString() : m_names[indexExpr]); string unitStr; unitStr.append(" ("); unitStr.append(m_units[indexExpr].AsString(false, true)); unitStr.append(") "); if (m_units[indexExpr].IsDate() && !m_dateAsPeriod ) { unitStr = ""; } if (m_units[indexExpr].IsDate() && !m_units[indexExpr].HasDateRef() ) { unitStr = ""; } *m_outputFile << colName << unitStr << " " << exprValueData.GetDimensionsAsString() << "\t"; } *m_outputFile << endl; m_writeHeader = false; } if (m_alwaysTrue == false) { if (exprValueSelect.IsTrue() != 1) { //Data doesn't match SELECT options, //------------- continue; //------------- } } for (uint32_t indexExpr = 0 ; indexExpr < m_fields.size() ; indexExpr++) { CExpressionValue exprValueData; recordSet->ExecuteExpression(m_fields[indexExpr], m_recordName, exprValueData, m_product); *m_outputFile << exprValueData.AsString(m_units[indexExpr], m_formats[indexExpr], m_dateAsPeriod) << "\t"; } *m_outputFile << endl; } //p->Tracer(1,"End writing data ..."); return result; }