Hi all,
having one requirement like there are two dates date 1 & date 2.then date 2 should be equal to + 1 day of date 1 (only week days, no sat, Sunday) what should I do?
Discussion posts and replies are publicly visible
Is that a UI question?
Did you check the a!addDateTime() function?
docs.appian.com/.../fnc_date_and_time_adddatetime.html
if( ri!date1+(day()*1)=ri!date2, null, "There was a problem " )
yes its Ui question I have to display date 2 on the basis of date 1 and in that only week days will consider like
Date 2= Date 1 + 1 ( business days only )
Hi Harshit
thanks for quick response but date 2 should auto populate on the basis date 1
and Date 2= Date 1 + 1 ( business days only ) so for skipping Saturday and Sunday what should I do?
Can you post the code that you've tried so far?
Did you read the documentation Stefan linked, by any chance? Because it seems to contain your answer...
{ a!dateField( label: "Date1", labelPosition: "ABOVE", value: ri!date1, saveInto: ri!date1, validations: {} ), a!dateField( label: "Date2", labelPosition: "ABOVE", value: ri!date1+1, saveInto: ri!date2, validations: {} ) }
Created this simple code its working and for date 2 its showing + 1 day but I have to skip saturady, sunday
So the issue here is, while this will show the "value" of "Date2" as "ri!date1+1", that value will never get saved into ri!date2, because the saveInto parameter of a component never evaluates until the user changes the value of that component.
The actual way to get the "ri!date1" component to effect the value of ri!date2, is to use the saveInto in the "Date1" date field to target BOTH variables (and preferably, show the "Date2" field as read-only).
saveInto: { ri!date1, a!save(ri!date2, ri!date1 + 1) }
As far as adding 1 to "date1" value but skipping weekends - i'm afraid Stefan already answered your question above along with the linked documentation which I even provided you a highlight of - to reiterate, you'll want to use a!addDateTime() and utilize the advanced functionality it contains, which includes a way to observe the system calendar in its date addition.
thanks Mike
In general, the trick is to change the underlying data, not trying to display things in a different way.