We have effective and expiration date fields on a new screen that I would like to default so that they display Always and Never when not set. How can I do this?
I am assuming you are using
DateCluster in which case it looks like:
_date.setStartNull(qsTr("Always"), mainwindow.startOfTime(), false); _date.setEndNull(qsTr("Never"), mainwindow.endOfTime(), false);
Effectively you are replacing the
NULL value in the display with the text provided, your query gets the date specified in the second parameter.
Hi, David. I think we are using the DateCluster. This is what I found in the script that sets the date variables.
pp_expired = mywidget.findChild("_ep_expired");
pp_effective = mywidget.findChild("_ep_effective");
I replaced the _date in your example with these field names and added the following lines.
pp_effective.setStartNull(qsTr(“Always”), mainwindow.startOfTime(), false);
pp_expired.setEndNull(qsTr(“Never”), mainwindow.endOfTime(), false);
The empty date did not change. What am I missing?
It turns out that we are not using the Date Cluster though we may change that. Thank you for the info.