Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 4 Jahren, 6 Monaten
Letzter Beitrag:
vor 4 Jahren, 6 Monaten
Beteiligte Autoren:
Victoria Caballero, Ned!, Fabrice Harari

[WB17] Null and zero values in numeric edit controls

Startbeitrag von Victoria Caballero am 26.11.2013 07:52

Hello everybody,
I have a kind of Form where the user needs to enter some numeric values. So what I need is that if the user type 0,00 in a numeric field the value saved in the DB is 0,00 but if the user does not type anything I need to save Null. So this is working fine actually by using the option "Returns NULL if empty" as you can see here: http://screencast.com/t/1d22yMEpC0iy

This is the Form I am talking about: http://screencast.com/t/OFxw1To7n5, and these are the values saved in the DB: http://screencast.com/t/QxolVfpT. As you can see the values are saved as expected. However the problem appears when the user open again the Form, the values that were saved before as 0,00 now appear blank in the Form: http://screencast.com/t/oBPfVNhWPAr0, so when the user save the Form again all those values are saved like Null instead of 0,00 which was their original value. I have been trying to figure out how to solve this but so far I have not found a solution. I can detect in the code in the initialization of the page if those fields actually have a Null value using this [table.fieldname].Null, if the property returns True is because the field holds a Null, if returns False is because there is another value of course. But then I can not show the value 0,00 in the edit controls in the page. So please any idea or help is welcome.
Thanks in advance.

Regards,

Victoria Caballero

Antworten:

Hi Victoria

I would try to use a text input field in which: 0=0 and empty=NULL

Best regards

von Fabrice Harari - am 26.11.2013 11:49
Hi Victoria,

Would it be possible for you to set an input mask on the field? Something like:


edt_Carb..inputmask = "999.999;+999.999;0.000;NULL"
(put < > round the NULL)


Format of Positive Numbers ; Format of Negative Numbers ; Value if 0 ; Value if NULL


This should display your 0 values as 0.000 and Nulls as empty

Thanks
Ned!

von Ned! - am 26.11.2013 11:54
Thanks Ned for your response.
I have tried to use this property in my edit controls and I get an error saying that this property is NOT found for this control. I do not understand why. According with the help this property applies to an edit control and can be used in server code however in the code editor I can not use it. Take a look here please: http://screencast.com/t/pZ4AhLIR

Actually this property does not exist in the list of ptoperties of the edit control. Does anybody knows why? http://screencast.com/t/1k7kesAHc. I ama little bit confused.

Thanks again

Regards,

Victoria

von Victoria Caballero - am 26.11.2013 13:52
Hi,

It looks like the InputMask property can be set in code for WebDev Report controls but not a page control.

You could try setting the Input Mask in the Properties of the control instead of the code? (You have it highlghted in your first image) http://screencast.com/t/1d22yMEpC0iy

Thanks
Ned!

von Ned! - am 26.11.2013 13:58
Hi Ned,
yes you are right, it seems that InputMask property is only available for WB reports :-(.
I have tried to use "999.999;+999.999;0.000;NULL" in the Input Mask Properties of the control as you sugested and it did not work unfortunatelly. So I guess I will try to use the text input field as Fabrice sugested before. I did not want to use this approach because it woul mean many changes in my code since I am making some math calculations with the values but let see how it goes.
Thanks anyway.

Regards,

Victoria

von Victoria Caballero - am 27.11.2013 11:05
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.