Foros de discusión
Programatically, reset a custom date field using ExpandoBridge
darren rose, modificado hace 8 años.
Programatically, reset a custom date field using ExpandoBridge
Regular Member Mensajes: 215 Fecha de incorporación: 4/04/15 Mensajes recientes
Hi,
Programatically, I need to reset/clear/set to null a custom field that is a date.
I am using the ExpandoBridge.
Any help welcomed, the errors I see when using null or empty string results in exceptions.
regards
Programatically, I need to reset/clear/set to null a custom field that is a date.
I am using the ExpandoBridge.
Any help welcomed, the errors I see when using null or empty string results in exceptions.
regards
Julien Mourad, modificado hace 8 años.
RE: Programatically, reset a custom date field using ExpandoBridge
Junior Member Mensajes: 78 Fecha de incorporación: 22/01/15 Mensajes recienteslayout.getExpandoBridge().setAttribute(String name, Serializable value, boolean secure)
ex: layout.getExpandoBridge().setAttribute("custom.value", "", false)
https://docs.liferay.com/portal/6.2/javadocs/com/liferay/portlet/expando/model/ExpandoBridge.html
darren rose, modificado hace 7 años.
RE: Programatically, reset a custom date field using ExpandoBridge
Regular Member Mensajes: 215 Fecha de incorporación: 4/04/15 Mensajes recientesJulien Mourad:
layout.getExpandoBridge().setAttribute(String name, Serializable value, boolean secure) ex: layout.getExpandoBridge().setAttribute("custom.value", "", false)
https://docs.liferay.com/portal/6.2/javadocs/com/liferay/portlet/expando/model/ExpandoBridge.html
using "" results in
java.lang.RuntimeException: jodd.typeconverter.TypeConversionException: Unable to convert value: ; <--- java.lang.NumberFormatException: For input string: ""
Pankaj Kathiriya, modificado hace 7 años.
RE: Programatically, reset a custom date field using ExpandoBridge
Liferay Master Mensajes: 722 Fecha de incorporación: 5/08/10 Mensajes recientes
Liferay uses millisecond value wrt(01/01/1970) for Date custom field. So you have to set its value as 0 instead "".
So,by setting it as 0, custom field value will be set as default date 01/01/1970.
So,by setting it as 0, custom field value will be set as default date 01/01/1970.
darren rose, modificado hace 7 años.
RE: Programatically, reset a custom date field using ExpandoBridge
Regular Member Mensajes: 215 Fecha de incorporación: 4/04/15 Mensajes recientesPankaj Kathiriya:
Liferay uses millisecond value wrt(01/01/1970) for Date custom field. So you have to set its value as 0 instead "".
So,by setting it as 0, custom field value will be set as default date 01/01/1970.
Sure, but actually, my business case is to reset a date to null and not 1/1/1970 - which doesn't seem possible?