Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible regression of QField when using Boolean type fields #5214

Closed
Meykaefer opened this issue Apr 26, 2024 · 10 comments
Closed

Possible regression of QField when using Boolean type fields #5214

Meykaefer opened this issue Apr 26, 2024 · 10 comments
Labels

Comments

@Meykaefer
Copy link

During recent fieldwork, colleagues encountered an issue with our QField project. Our project has a list of staff members, and each member is assigned a status indicating whether they are already active during the season. This status was used to filter the results in the value relationship widget, and only active staff (i.e., 'true') were shown in the combo box for selection, while inactive staff ('false') were hidden. This worked very well last year at the end of the season, but after returning to the field, we don't get any results in the box that usually lists staff. I replaced the boolean type field with an integer and assigned two values: 1 for true and 2 for false. After changing it to an integer value, the combo box shows the staff as it was by the end of last season.

Expected behavior

Expected behaviour is that QField would utilise the boolean type field values.

Observed behavior

The boolean type fields work in QGis but not in Qfield. Replacing boolean-type field values with integer values allows it to work in QField

Desktop (please complete the following information)

  • OS: [Windows 11]
  • QGIS Version [3.34.3]
  • QFieldSync Version N/A

Mobile (please complete the following information)

  • Device: [IPad 9th gen]
  • OS: [OS 17.2]
  • QField version: 3.2.2 (72be17 v3.2.2)]

Additional information

  • Problem started happening recently, didn't happen in an older version of QField: Yes
  • Problem can be reliably reproduced, doesn't happen randomly: Yes
  • Problem happens with all files and projects, not only some files or projects: Yes
@m-kuhn
Copy link
Member

m-kuhn commented Apr 27, 2024

Can you provide a minimal project with as little attributes and layers as possible to reproduce this behavior?

@nirvn
Copy link
Member

nirvn commented Apr 27, 2024

For the record I suspect it's this upstream regression that got fixed not too long ago:

qgis/QGIS#57060

@Meykaefer
Copy link
Author

Meykaefer commented Apr 27, 2024

@m-kuhn I made a sample project and attached it here.

The sample project contains an Employee layer with two columns for their active status. One column is a boolean type, and the other is an integer. When you select the fieldnotes layer and create an entry, go to the Crew tab, and select a region in the Team dropdown, the boolean box will remain empty, while the integer box will display values.

Also, this only happens in QField but not in QGis itself.

I hope this helps!

Sample Project.zip

@SeqLaz
Copy link
Member

SeqLaz commented Apr 27, 2024

@m-kuhn I made a sample project and attached it here.

The sample project contains an Employee layer with two columns for their active status. One column is a boolean type, and the other is an integer. When you select the fieldnotes layer and create an entry, go to the Crew tab, and select a region in the Team dropdown, the boolean box will remain empty, while the integer box will display values.

Also, this only happens in QField but not in QGis itself.

I hope this helps!

Sample Project.zip

In QField v3.2.2 and QGIS v3.36.2, I was unable to reproduce the issue you are experiencing.

Test Qfield checkbox boolean field 002.pdf

@Meykaefer
Copy link
Author

Hi @SeqLaz

I just looked at the pdf you uploaded maybe I wrote the instructions a little confusing. You used the employees layer but the crew selection actually happens in the "fieldnotes layer". (People usually don't see the Region and Employees layer - both layers are usually invisible)

See the three screenshots below

  1. select Fieldnotes layer and start editing
    IMG_0098

  2. Go to crew tab and select a region. The box on top uses the boolean field and the one at the bottom an integer
    IMG_0099
    IMG_0100

the boolean field combo box remains empty. If you go to the properties of the layer and look at the widget setup both boxes are identical with the only difference that the top one utilizes a boolean type field while the one at the bottom uses an integer

@SeqLaz
Copy link
Member

SeqLaz commented Apr 28, 2024

Hi @SeqLaz

I just looked at the pdf you uploaded maybe I wrote the instructions a little confusing. You used the employees layer but the crew selection actually happens in the "fieldnotes layer". (People usually don't see the Region and Employees layer - both layers are usually invisible)

See the three screenshots below

  1. select Fieldnotes layer and start editing
    IMG_0098
  2. Go to crew tab and select a region. The box on top uses the boolean field and the one at the bottom an integer
    IMG_0099
    IMG_0100

the boolean field combo box remains empty. If you go to the properties of the layer and look at the widget setup both boxes are identical with the only difference that the top one utilizes a boolean type field while the one at the bottom uses an integer

Hello @Meykaefer,

I understand now, the issue is not with QField. The problem lies in the expression you are using. You have used the string 'true' instead of a boolean type. For a boolean, you need to follow the SQL language convention and use True or TRUE, without any quotation. You will notice that in the expression editor, the boolean type is highlighted with a different color than strings. To fix the issue, you just need to change the string to a boolean type.

Test Qfield checkbox boolean field 003.pdf

@Meykaefer
Copy link
Author

Hi @SeqLaz,

Thank you for figuring this out! Nonetheless, I do think something changed somewhere along the line. I have field projects that from December which are set up identical to the sample I provided and I was able to record the crew on site. And once we returned from the winter break it all of a sudden didn't work anymore.

That is the reason I thought it could be a possible regression since something that previously worked stopped working.

Thank you for pointing out the reason and providing a solution!

@nirvn
Copy link
Member

nirvn commented Apr 28, 2024

@Meykaefer , can you try the sample project that stopped working against the APK here: #5216 (comment) ? Thanks

@Meykaefer
Copy link
Author

@nirvn , I would gladly test the APK, but I don't know how to do it. I only have access to iOS devices, and I don't know how to install this APK. If you have some instructions on what I need to do I can do and test it.

@SeqLaz
Copy link
Member

SeqLaz commented Apr 28, 2024

Hey @nirvn It is not possible to use a string 'true' as a replacement for a True type value when using the compiled version of QField and the original project shared by @Meykaefer.

Test QField compiled preview checkbox 001.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants