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

QField casting of UUID vs desktop QGIS #5822

Closed
antoineouellet opened this issue Nov 15, 2024 · 1 comment
Closed

QField casting of UUID vs desktop QGIS #5822

antoineouellet opened this issue Nov 15, 2024 · 1 comment

Comments

@antoineouellet
Copy link

Describe the issue

QField seems to handle casting of UUIDs to string differently than QGIS, with the result being inconsistent data whether it is digitized on mobile or on desktop.

QGIS casts UUID types to its pure hex representation (e.g. '9ec9a230-4866-4e45-ab59-b8610b02711f') whereas it is cast to brackets in QField (e.g. '{9ec9a230-4866-4e45-ab59-b8610b02711f}').

Reproduction steps

Steps to reproduce the behavior:

  1. For a layer, make an uuid autogenerated field (form field uneditable, default uuid() )
  2. Make a virtual field with expression left(to_string("uuid"),4).
  3. Digitize a new entry on desktop, with automatic uuid. Virtual field shows: 9ec9.
  4. Digitize a new entry on mobile, with automatic uuid. Virtual field shows: {9ec.

Expected behavior

QField represents uuid as '{xxx}' whereas QGIS represents uuid as 'xxx'. I would expect it to be consistent, preferably 'xxx'.

Screenshots and GIFs

462547743_459754630467247_8686060505033892626_n

Showing entries on QField, we can see which ones were digitized previously on desktop, and which one in mobile session.

QGIS (please complete the following information)

  • OS: Linux
  • QGIS Version 3.36.1
  • QFieldSync Version 4.11.10

QField (please complete the following information)

  • Device: Pixel 6a
  • OS: Android 14
  • QField version: 3.4.5

Additional information

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

nirvn commented Nov 16, 2024

@antoineouellet , uuid() format varies across platforms (e.g. on Windows you won't have the {} by default whereas on Linux and Android they are present).

The solution is to explicitly asks for generated uuids without braces through the following function parameter: uuid('WithoutBraces').

Happy field mapping!

@nirvn nirvn closed this as completed Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants