1

I had created screen flow with three component. Screen Flow

Component 1:Start Date
Type- Date Component
enter image description here

Component 2:End Date
Type- Date Component
Default Value - Formula(Start Date + Days Left) enter image description here

Component 3:Days Left
Type- Number Component
Default Value - Formula(End Date - Start Date) enter image description here

The following logic is working fine when I update the closed date then the days left are calculated according to the formula or vice versa but when I update the when start date the days left are not updating. Seems like reactivity is not working when I update the start date.

1 Answer 1

0

You're trying to calculate recursive formula which is not possible.
Closed Date = Start Date + Days Left
Days Left = Closed Date - Start Date

Scenario 1:
User Input : Start Date = 02/11/2023
User Input : Closed Date = 03/11/2023
Now, As per formula Days Left = Closed Date - Start Date will give 1 as value.
Which is working fine.

Scenario 2:
Don't clear Above values and change value of Days Left.
User Input : Days Left = 2
Now, As per formula Closed Date = Start Date + Days Left will give Date as 04/11/2023

Scenario 3:
Don't clear Above value and change Start Date.
User Input : Start Date = 01/11/2023
Now, there are two formulas which needs to calculate and both are dependent on each other.
Closed Date = Start Date + Days Left ---> Which is dependent on Days Left
Days Left = Closed Date - Start Date ---> Which is dependent on Days Left
Which is practically not possible.

Solution 1:
Simply remove Days Left as input cmp and display just output of DaysLeftFormula
enter image description here

Solution 2:
What you can do is Add one input between Start Date & Closed Date and Label it as "Add Days".
And Add one more dispayText component for Days Left Formula.

Where Add Days don't have any default formula
Where EndDateFormula = Start Date + Add Days which is default value for End Date
Where DaysLeftFormula = End Date - Start Date
enter image description here

NOTE: Now It'll work as per your requirement but you may have to somehow hide Add Days cmp after changing it's value as it's not actually formula and will confuse end user.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .