Skip to content

Commit

Permalink
Fix merge attribute dialog picks wrong field values when fields are h…
Browse files Browse the repository at this point in the history
…idden
  • Loading branch information
nyalldawson committed Apr 3, 2018
1 parent adf5d79 commit 001796d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/qgsmergeattributesdialog.cpp
Expand Up @@ -285,6 +285,8 @@ void QgsMergeAttributesDialog::refreshMergedValue( int col )
return;
}

int fieldIdx = mTableWidget->horizontalHeaderItem( col )->data( FieldIndex ).toInt();

//evaluate behavior (feature value or min / max / mean )
QString mergeBehaviorString = comboBox->currentData().toString();
QVariant mergeResult; // result to show in the merge result field
Expand All @@ -304,13 +306,13 @@ void QgsMergeAttributesDialog::refreshMergedValue( int col )
{
//an existing feature value
QgsFeatureId featureId = STRING_TO_FID( mergeBehaviorString.mid( 1 ) );
mergeResult = featureAttribute( featureId, col );
mergeResult = featureAttribute( featureId, fieldIdx );
}
else
{
//numerical statistic
QgsStatisticalSummary::Statistic stat = ( QgsStatisticalSummary::Statistic )( comboBox->currentData().toInt() );
mergeResult = calcStatistic( col, stat );
mergeResult = calcStatistic( fieldIdx, stat );
}

//insert string into table widget
Expand Down

0 comments on commit 001796d

Please sign in to comment.