QSQLQuery is not null
-
Hi everyone,
In documentation of QsqlQuery we have functions isNull()
OK, but... is there function to other side (like title 'isNotNull')?I my current code I don't need NULL values to put into comboBox, but option if isnull else:... is too long (and in if I needen't write anything)?
Have you some idea to solve it (make code shorter)?
Current code looks that:
if query.record().isNull("DATE_TO_TAKE"): print (query.record().value("DATE_TO_TAKE"))#Don't need it else: self.dlg.comboBox_20.addItem(query.record().value(""DATE_TO_TAKE").toString('dd.MM.yyyy')) #This is correct
-
Hi everyone,
In documentation of QsqlQuery we have functions isNull()
OK, but... is there function to other side (like title 'isNotNull')?I my current code I don't need NULL values to put into comboBox, but option if isnull else:... is too long (and in if I needen't write anything)?
Have you some idea to solve it (make code shorter)?
Current code looks that:
if query.record().isNull("DATE_TO_TAKE"): print (query.record().value("DATE_TO_TAKE"))#Don't need it else: self.dlg.comboBox_20.addItem(query.record().value(""DATE_TO_TAKE").toString('dd.MM.yyyy')) #This is correct
@Karoluss96 said in QSQLQuery is not null:
isNotNull
Isn't it the same as !isNull?
Or did I misunderstand your question? -
Hi everyone,
In documentation of QsqlQuery we have functions isNull()
OK, but... is there function to other side (like title 'isNotNull')?I my current code I don't need NULL values to put into comboBox, but option if isnull else:... is too long (and in if I needen't write anything)?
Have you some idea to solve it (make code shorter)?
Current code looks that:
if query.record().isNull("DATE_TO_TAKE"): print (query.record().value("DATE_TO_TAKE"))#Don't need it else: self.dlg.comboBox_20.addItem(query.record().value(""DATE_TO_TAKE").toString('dd.MM.yyyy')) #This is correct
@Karoluss96
Python:if not query.record().isNull("DATE_TO_TAKE"): self.dlg.comboBox_20.addItem(query.record().value(""DATE_TO_TAKE").toString('dd.MM.yyyy')) #This is correct