qfieldsync icon indicating copy to clipboard operation
qfieldsync copied to clipboard

QGis Extension QField : changing type numeric

Open gsollberger opened this issue 4 years ago • 27 comments

Hi, A QGis project is connected to 2 postgres/postgis layers : eu_grille_pg09 and eu_chambre_pg10. This layers contain char attributes and numeric attributes, for exmple 'alt_couv' defined with double precision in postgres. Extension QField Sync "transform" this QGis project in QField project with gpkg data ... *et là c'est le drame" ... the numeric attributes are not decimal : 79334718-1c14e080-7f21-11ea-9206-962e9378e3e6

Impossible to enter an altitude without decimal numbers.

Any one for a solution ?

Thank's a lot and best regards.

Gérard Sollberger HKD Géomatique Vaud SA

My environnement :

QGis 3.12.1 QField Sync extension : 3.1.6 postgres 9 et 10 QField on dive Mobile : 1.4.4 Device mobile : Samsung Galaxy Tab Active 2 tmp-qfield.zip

gsollberger avatar Jun 02 '20 10:06 gsollberger

Hi

Can you check on "formulaire d'attributs" if "text edit" or "range" widgets are used? In the latest version only "range" will work for doubles (but this will change again in future versions and "text edit" support for numeric will be back).

m-kuhn avatar Jun 02 '20 11:06 m-kuhn

Hi Matthias, I've tried the 2 options (text edit and range) ... both doesn't work :-( On QField, the comma sign in the virtual keyboard is not "usable".

Any other idea ?

Best regards.

Gérard Screenshot_20200603-145549_QField

gsollberger avatar Jun 03 '20 12:06 gsollberger

Use the point below the OK?

m-kuhn avatar Jun 03 '20 12:06 m-kuhn

it doesn't work ...

gsollberger avatar Jun 03 '20 12:06 gsollberger

Annotation 2020-06-03 150118 this is he configuration of the attribute "profondeur" in the qgs file, used by qfield

gsollberger avatar Jun 03 '20 13:06 gsollberger

Can you test the "simple bee farming" demo project, open the form for a bee hive and edit "yearly harvest (kg)". Does it work there? Screenshot_20200603-150608_QField

m-kuhn avatar Jun 03 '20 13:06 m-kuhn

where may i download this proejct ?

gsollberger avatar Jun 03 '20 13:06 gsollberger

It's preinstalled in qfield, so should already be there.

It can also be downloaded from https://github.com/opengisch/QField/tree/master/resources/demo_projects

m-kuhn avatar Jun 03 '20 13:06 m-kuhn

OK, thanks, I've tried this project with my Samsung Tab Active 2 and my Samsung S8 phone ... the coma isn't usable ...

gsollberger avatar Jun 03 '20 13:06 gsollberger

I've been testing this now with two different releases and I also see strange effects.

I do have a , on my keyboard which is replaced with nothing on save (e.g. 33,5 -> save -> 335). I also do have a . on my keyboard. If I press it, nothing happens (i.e. the number in the text edit stays unchanged).

m-kuhn avatar Jun 03 '20 13:06 m-kuhn

the same ...

gsollberger avatar Jun 03 '20 13:06 gsollberger

I have a different behavior on 1.4.4 and on master than you have. Comma is disabled like @gsollberger described, but I can enter dots. Why @m-kuhn has the same behavior on commas but cannot enter dots I don't know. Maybe language settings? But anyway, I think the behavior on Matthias system with comma is what it is otherwise with dots.

My behavior on master:

  • (int) Range widget: removes the dot during entering again - since it's not allowed - value without decimals stored
  • (int) Text Edit widget: accepts dots but on save it rounds the value (should react like range, this is the bug I mentioned here https://github.com/opengisch/QField/commit/fbb0c9759139420fe1683255e75ae1b035970fc3#r39657048 but it does not have anything to do with this issue) - value without decimals stored
  • (real) Range widget: dots accepted - value with decimals stored
  • (real) Text Edit widget: dots accepted - value with decimals stored

My behavior on 1.4.4 is like it should:

  • (int) Range widget: removes the dot during entering again - since it's not allowed - value without decimals stored
  • (int) Text Edit widget:removes the dot during entering again - since it's not allowed - value without decimals stored
  • (real) Range widget: dots accepted - value with decimals stored
  • (real) Text Edit widget: dots accepted - value with decimals stored

So I think I cannot reproduce @gsollberger issue. I can enter decimals in your project with 1.4.4 WhatsApp Image 2020-06-04 at 09 25 18

Do I misunderstand something? :thinking:

signedav avatar Jun 04 '20 07:06 signedav

Here is the project I used to test integer range, integer text edit, double range and double text edit. Maybe you want to have a try @gsollberger

doubletrouble.zip

Btw. the demo projects yearly harvest field is integer - so the behavior at @m-kuhn covers mine (just having comma but dot instead)...

signedav avatar Jun 04 '20 07:06 signedav

Found a lead. When setting my phone to "Français (Suisse)" I can reproduce the issue of @gsollberger

signedav avatar Jun 04 '20 07:06 signedav

No solution yet.

Apparently on the swiss-french locale configured, still the dot is displayed to enter as separator. But the DoubleValidator does not accept it. I had no success in setting the DoubleValidators locale: Qt.locale("C") to set the validators locale setting to the C locale.

Additionally I tried to set this in main.cpp, but it has no influence. The decimalPoint is still a comma after:

setlocale(LC_NUMERIC, "C");
QLocale::setDefault( QLocale::system() );

signedav avatar Jun 04 '20 20:06 signedav

See a possible workaround here https://github.com/opengisch/qfield/pull/1047

signedav avatar Jun 04 '20 20:06 signedav

@gsollberger short summary:

There is a problem with entering numeric (decimal) values. In some translations/locales. As a short term solution you can set your device to English. We will be looking into a fix for this. If you would like to speed up things, please contact [email protected].

m-kuhn avatar Jun 05 '20 07:06 m-kuhn

Hi, Yeah ! it works ;-) I'll configure my device in english . Thank's for the workaround and Best regards.

Gérard

gsollberger avatar Jun 05 '20 08:06 gsollberger

@gsollberger can we ask you to test the apk in https://github.com/opengisch/QField/pull/1047#issuecomment-654216140 ? Thank you!

m-kuhn avatar Jul 06 '20 13:07 m-kuhn

Mais en français :-)

signedav avatar Jul 06 '20 13:07 signedav

Pardon, David. @gsollberger est-ce que je peux vous demander de tester si l'apk dans https://github.com/opengisch/QField/pull/1047#issuecomment-654216140 marche? Merci!

m-kuhn avatar Jul 06 '20 13:07 m-kuhn

I actually wanted to say, that the tests have to be done with a device set to french. But I guess it was clear for both or you before. Sorry, for the confusion. :slightly_smiling_face:

signedav avatar Jul 06 '20 14:07 signedav

Hi, Sorry for my very late answer ... i wasn't much available this days. Where can i download the apk ? Thanks and best regards. Gérard

gsollberger avatar Jul 16 '20 12:07 gsollberger

See link in my previous message https://github.com/opengisch/qfieldsync/issues/153#issuecomment-654244159

m-kuhn avatar Jul 16 '20 12:07 m-kuhn

Thank's for your answer. I confirm : it works with french language device. Tnak's for your work. Best regards.

Gérard

gsollberger avatar Jul 16 '20 13:07 gsollberger

Thank you for the feedback !

m-kuhn avatar Jul 16 '20 13:07 m-kuhn

Hi guys,

I still have the issue you are describing here. I have tried for the qgep_import.vw_manhole view on the field _depth.

I have the issue with both French or English language.

QGIS: 3.10.6 QField : 1.7.8 Galaxy Tab A7 Android 10

Thanks a lot

varrieta avatar Jan 21 '21 11:01 varrieta