Solved

Can you default a date field to tomorrows date?

  • 26 January 2018
  • 3 replies
  • 21 views

Badge +8

I have a requirement for a begin date to be the next days date.

 

I entered an expression on the field to set it to tomorrow.  It does display, and allow someone to change the date.

 

Here is my problem, when I reuse that view with the date field, it displays tomorrows date; not what was entered in the smartbox object.

 

Is there a setting or work around to display this smartbox object correctly?

icon

Best answer by BKlaege 29 January 2018, 18:07

View original

3 replies

Badge +6

Hello,

 

Can you elaborate in more details . what you want to do and whats the requirment ?

 

-Thanks

Userlevel 4
Badge +13

Hi


 


I think that your issue comes in that you are not loading the SmartObjects value into the control that shoudl display the saved date therefore I suggest that you use the on list item click event and do execute a SmartObject load event and supply the load event with the record Id that you want to return. In essance your solution would then have the date control set to tomorrow and it will be saved as such as per your explained design however for the date control to display the date of the previously saved record you would need to load it at some point as your solution is designed to execute the expression and show the tomorrow date when the control is initialized.


 


You can have a look at the package I created in K2 4.7 as a refrence to the above.


 


Kind Regards


Raymond


 

Badge +8

Thanks for your reply Raymond.

 

I do not know how to look at your package, but based on your comments, I believe I am loading the field from my smartbox object on display.  The expression is overriding that and always displaying tomorrows date.  It was showing the date when the control was initialized, but also not showing the date from the smartbox object on load.

 

My workaround (which may be your solution) is to remove the expression from every time the field is initialized (displayed in the view)

 

I then added a rule in only the form which someone needs to enter the date to do a transfer data and fill the date from the same expression.

 

So, the logic would be to 

1) fill the date from the expression on entry (thereby defaulting the date to tomorrow).  Done through transfer data, not initialize.

2) the person filling the form could chose another date if wanted by clicking on the calendar and selecting a date

3) the date is saved in the smartbox object

4) when the date is shown from any view showing the smartbox object, it shows the contents of the date entered.  Expression is not used.

 

Thanks!

Reply