/// <summary> /// Prepare mapping of Destination field to Source Field. /// For that maintain a dictionary with key as destination field name and /// value as index of the source field in the FieldsTable. /// </summary> /// <param name="record"></param> private void PrepareDestinationToSourceFieldIndexMapping(List <FieldDef> sourceVarList) { FieldsTable fieldsTab = ((DataView)task.DataView).GetFieldsTab(); int sourceFieldIndex = 0; foreach (DBField dbfield in destinationColumnList) { FieldDef field = sourceVarList[sourceFieldIndex++]; for (int fieldIndex = 0; fieldIndex < fieldsTab.getSize(); fieldIndex++) { if (field.getVarName() == fieldsTab.getField(fieldIndex).getVarName()) { destinationToSourceFieldIndexMapping.Add(dbfield.Name, fieldIndex); break; } } } }
/// <summary> /// Prepare the list of selected columns of source dataview. /// </summary> /// <returns></returns> private List <FieldDef> PrepareSourceFieldList() { string[] fieldNamesList = dataViewOutputCommand.TaskVarNames.Split(','); List <FieldDef> sourceFieldList = new List <FieldDef>(); foreach (string fieldName in fieldNamesList) { for (int fieldIndex = 0; fieldIndex < ancestorTask.DataView.GetFieldsTab().getSize(); fieldIndex++) { FieldDef field = ancestorTask.DataView.GetFieldsTab().getField(fieldIndex); if (field.getVarName() == fieldName) { sourceFieldList.Add(field); break; } } } return(sourceFieldList); }