@@ -145,7 +145,6 @@ void QgsFieldCalculator::accept()
145145
146146 // go through all the features and change the new attribute
147147 QgsFeature feature;
148- bool calculationSuccess = true ;
149148
150149 bool onlySelected = ( mOnlyUpdateSelectedCheckBox ->checkState () == Qt::Checked );
151150 QgsFeatureIds selectedIds = mVectorLayer ->selectedFeaturesIds ();
@@ -173,10 +172,10 @@ void QgsFieldCalculator::accept()
173172 searchTree->getValue ( value, searchTree, mVectorLayer ->pendingFields (), feature );
174173 if ( value.isError () )
175174 {
176- calculationSuccess = false ;
177- break ;
175+ // insert NULL value for this feature and continue the calculation
176+ mVectorLayer -> changeAttributeValue ( feature. id (), attributeId, QVariant (), false ) ;
178177 }
179- if ( value.isNumeric () )
178+ else if ( value.isNumeric () )
180179 {
181180 mVectorLayer ->changeAttributeValue ( feature.id (), attributeId, value.number (), false );
182181 }
@@ -191,18 +190,6 @@ void QgsFieldCalculator::accept()
191190 // stop blocking layerModified signals and make sure that one layerModified signal is emitted
192191 mVectorLayer ->blockSignals ( false );
193192 mVectorLayer ->setModified ( true , false );
194-
195-
196- if ( !calculationSuccess )
197- {
198- QMessageBox::critical ( 0 , tr ( " Error" ), tr ( " An error occured while evaluating the calculation string." ) );
199-
200- // remove new attribute
201- mVectorLayer ->deleteAttribute ( attributeId );
202- mVectorLayer ->destroyEditCommand ();
203- return ;
204- }
205-
206193 mVectorLayer ->endEditCommand ();
207194 }
208195 QDialog::accept ();
0 commit comments