Page 1 of 1

Delete a date

PostPosted: Wed Mar 13, 2013 2:19 am
by fieldhopper
Hi !

I have a date-field in a mysql-db. On start the field contains NULL. The user fills the field with a date. When i now try to delete this field with blank or zero, the old content will reset to the input of the user. How can i delete this field with neobook.

Re: Delete a date

PostPosted: Wed Mar 13, 2013 9:34 am
by Neosoft Support
You can try setting the date to an empty string, but if the database won't accept it then you will have to substitute a different date.

Re: Delete a date

PostPosted: Thu Mar 12, 2015 4:27 am
by fieldhopper
Ok, i have found, after a long time, the special idea to delete the date.
Code: Select all
If "[LEP.teilzeit.Tgiltbis]" "=" "  .  .    "
SetVar "[z_id]" "[LEP.teilzeit.id]"
dbpExecSQL "LEP" "update teilzeit set tgiltbis = NULL where id=[z_id]" ""
endif

That is the result and it funzt :).

Re: Delete a date

PostPosted: Thu Mar 12, 2015 7:08 am
by stu
fieldhopper wrote:Ok, i have found, after a long time, the special idea to delete the date.
Code: Select all
If "[LEP.teilzeit.Tgiltbis]" "=" "  .  .    "
SetVar "[z_id]" "[LEP.teilzeit.id]"
dbpExecSQL "LEP" "update teilzeit set tgiltbis = NULL where id=[z_id]" ""
endif

That is the result and it funzt :).


Quick question!

Why would you have something like " . . " stored on a db? is some sort of default?

Re: Delete a date

PostPosted: Thu Mar 12, 2015 8:42 am
by fieldhopper
It comes from the Inputfield. Use a mask for formatted input. The db-field is stored normally.

Re: Delete a date

PostPosted: Thu Mar 12, 2015 10:21 am
by Neosoft Support
Thanks for sharing your discovery with us!

Re: Delete a date

PostPosted: Thu Mar 12, 2015 11:12 am
by stu
fieldhopper wrote:It comes from the Inputfield. Use a mask for formatted input. The db-field is stored normally.


What about not allowing the user to input and instead using dbpPopupDateSelector (?) then you no longer expose your data to inconsistency.

Re: Delete a date

PostPosted: Thu Mar 12, 2015 11:19 pm
by fieldhopper
Thanks for this nice note dbpPopupDateSelector. But how to delete the date (set to NULL)?.

Re: Delete a date

PostPosted: Fri Mar 13, 2015 11:04 am
by stu
fieldhopper wrote:Thanks for this nice note dbpPopupDateSelector. But how to delete the date (set to NULL)?.


Sorry I got a bit lost on this last post. Can you explain a bit of the process your trying to accomplish so I can get an insight? =)

Re: Delete a date

PostPosted: Sun Mar 15, 2015 8:44 am
by fieldhopper
fieldhopper wrote:Ok, i have found, after a long time, the special idea to delete the date.
Code: Select all
If "[LEP.teilzeit.Tgiltbis]" "=" "  .  .    "
SetVar "[z_id]" "[LEP.teilzeit.id]"
dbpExecSQL "LEP" "update teilzeit set tgiltbis = NULL where id=[z_id]" ""
endif

That is the result and it funzt :).


So was my start for this topic.