17
Views
5
Comments
[OutSystems UI] Issue with DatePicker
outsystems-ui
Reactive icon
Forge asset by OutSystems
Application Type
Reactive

Hi All,

I am using calendar widget, although i have certain conditions, we have initial training date which we are displaying, and user can only allow to select the date from curr date to past 335 days, which is fine,, but if suppose user selected some date for eg 03-12-2024, now since its out of the criteria of 335 days its not getting displayed in calendar, I tried to handle it with condition below :


If(DiCELASPs.Current.DiCELASP.Id = NullIdentifier(),AddDays(CurrDate(),-335), If(DiCELASPs.Current.DiCELASP.SPInitialTrainingDate = NullDate(), AddDays(CurrDate(),-335), DiCELASPs.Current.DiCELASP.SPInitialTrainingDate)),, but with this conditon i faced another issue which is if selected date is 1st april 2026 then post that only user can make a selection previous date wont be allowed , so 355 criteria fails ,


then i remodified the condition to below:

If(DiCELASPs.Current.DiCELASP.Id = NullIdentifier(),AddDays(CurrDate(),-335), If(DiCELASPs.Current.DiCELASP.SPInitialTrainingDate = NullDate(), AddDays(CurrDate(),-335), If(DiffDays(DiCELASPs.Current.DiCELASP.SPInitialTrainingDate, CurrDate()) > 355,DiCELASPs.Current.DiCELASP.SPInitialTrainingDate,AddDays(CurrDate(),-335))))

but now calendar does not displays the date which is in the range curr date to 335 days..


This condition I have provided in the min date property of the calendar.. I am not sure how to handle this and I really need urgent help with this.. Please request you all to kindly help or provide your suggestions.


Thanks

Shivangi

 

2026-01-28 16-57-48
Mihai Melencu
Champion

Hi @Shivangi Thakur ,

Are you using the DatePicker or the normal calendar input? Also are you able to share your OML or recreate your use-case?

2019-03-12 12-28-20
Shivangi Thakur

Hi @Mihai Melencu

I am using date picker, I didnt face issue in my personal environment, but in the main environment we have OutsystemsUI version - Version 2.21.0, 

Attaching the oml for better understanding, but since its developed in my personal with verison - Version 2.28.0 I didnt face any issue.


DatePickerTestApp.oml
2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi @Shivangi Thakur ,

for starters, you are playing a bit fast and loose with your conditions, is it 355 OR 335, now you use both.

as for the date not showing, it is worth installing older versions of OutSystems UI in your personal environment and see if you can then get the same problem.  In that case, it's a matter of upgrading at your client before you can use this without problem.  If you try all versions from 21 upwards, you can advice your company to what version they will at least need to upgrade.

And for the condition, yes, a simple Min(cur-355, saved date) won't work, you're stuck with something like If(no saved date yet or less than 355 days ago, then curr - 355, otherwise saved date) 

But you wouldn't have to make the distinction between the record id being nullidentifier and the date being nulldate, the first doesn't add anything.

So rewrite to

If( 
    DiCELASPs.Current.DiCELASP.SPInitialTrainingDate = NullDate() OR
    DiffDays(DiCELASPs.Current.DiCELASP.SPInitialTrainingDate, CurrDate()) < 355 , 
    AddDays(CurrDate(),-355), 
    DiCELASPs.Current.DiCELASP.SPInitialTrainingDate
) 

Dorine

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Or i like this even better

If(     
    DiCELASPs.Current.DiCELASP.SPInitialTrainingDate = NullDate() OR 
    DiCELASPs.Current.DiCELASP.SPInitialTrainingDate > AddDays(CurrDate(),-355)  ,     
    AddDays(CurrDate(),-355),     
    DiCELASPs.Current.DiCELASP.SPInitialTrainingDate) 

Dorine

2021-09-06 15-09-53
Dorine Boudry
 
MVP

And even better, if you write a little client function, you only have to do the adddays once, avoiding discrepancies like 335 vs 355

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.