filterring on IS NOT NULL using QSqlTableModel::setFilter(const QString &filter)
up vote
0
down vote
favorite
If I'd like to filter on the IS NOT NULL condition using QSqlTableModel::setFilter(const QString &filter), what filter syntax should I pass to the method ?
sql qt sqlite pyqt pyside
add a comment |
up vote
0
down vote
favorite
If I'd like to filter on the IS NOT NULL condition using QSqlTableModel::setFilter(const QString &filter), what filter syntax should I pass to the method ?
sql qt sqlite pyqt pyside
Just wondering whether you read the documentation and understood it or not. 🤔 I think the docs are pretty straightforward about this.
– TrebuchetMS
Nov 22 at 15:09
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
If I'd like to filter on the IS NOT NULL condition using QSqlTableModel::setFilter(const QString &filter), what filter syntax should I pass to the method ?
sql qt sqlite pyqt pyside
If I'd like to filter on the IS NOT NULL condition using QSqlTableModel::setFilter(const QString &filter), what filter syntax should I pass to the method ?
sql qt sqlite pyqt pyside
sql qt sqlite pyqt pyside
asked Nov 22 at 14:46
iMath
8991648
8991648
Just wondering whether you read the documentation and understood it or not. 🤔 I think the docs are pretty straightforward about this.
– TrebuchetMS
Nov 22 at 15:09
add a comment |
Just wondering whether you read the documentation and understood it or not. 🤔 I think the docs are pretty straightforward about this.
– TrebuchetMS
Nov 22 at 15:09
Just wondering whether you read the documentation and understood it or not. 🤔 I think the docs are pretty straightforward about this.
– TrebuchetMS
Nov 22 at 15:09
Just wondering whether you read the documentation and understood it or not. 🤔 I think the docs are pretty straightforward about this.
– TrebuchetMS
Nov 22 at 15:09
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
From the docs:
The filter is a SQL WHERE clause without the keyword WHERE (for example,
name='Josephine'
).
So an appropriate filter with IS NOT NULL
would resemble
mySqlTableModel.setFilter("id IS NOT NULL");
Thanks! I tired with your answer before , it didn’t work , but a later examination showed that it is because I saved an empty string “” instead of null in the database that caused the filter failed , worked after changed to mySqlTableModel.setFilter(‘id IS NOT “”’).
– iMath
Nov 22 at 15:37
Ahaha, so the issue wasn't actually related withis not null
. :P At least you've figured out and traced where the issue lay.
– TrebuchetMS
Nov 22 at 15:39
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
From the docs:
The filter is a SQL WHERE clause without the keyword WHERE (for example,
name='Josephine'
).
So an appropriate filter with IS NOT NULL
would resemble
mySqlTableModel.setFilter("id IS NOT NULL");
Thanks! I tired with your answer before , it didn’t work , but a later examination showed that it is because I saved an empty string “” instead of null in the database that caused the filter failed , worked after changed to mySqlTableModel.setFilter(‘id IS NOT “”’).
– iMath
Nov 22 at 15:37
Ahaha, so the issue wasn't actually related withis not null
. :P At least you've figured out and traced where the issue lay.
– TrebuchetMS
Nov 22 at 15:39
add a comment |
up vote
0
down vote
accepted
From the docs:
The filter is a SQL WHERE clause without the keyword WHERE (for example,
name='Josephine'
).
So an appropriate filter with IS NOT NULL
would resemble
mySqlTableModel.setFilter("id IS NOT NULL");
Thanks! I tired with your answer before , it didn’t work , but a later examination showed that it is because I saved an empty string “” instead of null in the database that caused the filter failed , worked after changed to mySqlTableModel.setFilter(‘id IS NOT “”’).
– iMath
Nov 22 at 15:37
Ahaha, so the issue wasn't actually related withis not null
. :P At least you've figured out and traced where the issue lay.
– TrebuchetMS
Nov 22 at 15:39
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
From the docs:
The filter is a SQL WHERE clause without the keyword WHERE (for example,
name='Josephine'
).
So an appropriate filter with IS NOT NULL
would resemble
mySqlTableModel.setFilter("id IS NOT NULL");
From the docs:
The filter is a SQL WHERE clause without the keyword WHERE (for example,
name='Josephine'
).
So an appropriate filter with IS NOT NULL
would resemble
mySqlTableModel.setFilter("id IS NOT NULL");
answered Nov 22 at 15:06
TrebuchetMS
1,6031618
1,6031618
Thanks! I tired with your answer before , it didn’t work , but a later examination showed that it is because I saved an empty string “” instead of null in the database that caused the filter failed , worked after changed to mySqlTableModel.setFilter(‘id IS NOT “”’).
– iMath
Nov 22 at 15:37
Ahaha, so the issue wasn't actually related withis not null
. :P At least you've figured out and traced where the issue lay.
– TrebuchetMS
Nov 22 at 15:39
add a comment |
Thanks! I tired with your answer before , it didn’t work , but a later examination showed that it is because I saved an empty string “” instead of null in the database that caused the filter failed , worked after changed to mySqlTableModel.setFilter(‘id IS NOT “”’).
– iMath
Nov 22 at 15:37
Ahaha, so the issue wasn't actually related withis not null
. :P At least you've figured out and traced where the issue lay.
– TrebuchetMS
Nov 22 at 15:39
Thanks! I tired with your answer before , it didn’t work , but a later examination showed that it is because I saved an empty string “” instead of null in the database that caused the filter failed , worked after changed to mySqlTableModel.setFilter(‘id IS NOT “”’).
– iMath
Nov 22 at 15:37
Thanks! I tired with your answer before , it didn’t work , but a later examination showed that it is because I saved an empty string “” instead of null in the database that caused the filter failed , worked after changed to mySqlTableModel.setFilter(‘id IS NOT “”’).
– iMath
Nov 22 at 15:37
Ahaha, so the issue wasn't actually related with
is not null
. :P At least you've figured out and traced where the issue lay.– TrebuchetMS
Nov 22 at 15:39
Ahaha, so the issue wasn't actually related with
is not null
. :P At least you've figured out and traced where the issue lay.– TrebuchetMS
Nov 22 at 15:39
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53433402%2ffilterring-on-is-not-null-using-qsqltablemodelsetfilterconst-qstring-filter%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Just wondering whether you read the documentation and understood it or not. 🤔 I think the docs are pretty straightforward about this.
– TrebuchetMS
Nov 22 at 15:09