This If statement is inside the Default section of a text input called txtTotalHours. It's a simple If statement that has 2 conditions. Condition one checks if a textbox is not empty. If it's not empty, the default value from the SharePoint database populates txtTotalHours. If it is empty, the default condition populates txtTotalHours by using the DateDiff calculation in the formula. The default condition does not work but condition 1 does work. See the If statement below:
If(!IsEmpty(txtNumber), Parent.Default, DateDiff(
Start.SelectedDate + Time(Value(StartHour.Selected.Value), Value(StartMinute.Selected.Value), 0),
End.SelectedDate + Time(Value(EndHour.Selected.Value), Value(EndMinute.Selected.Value), 0),
Hours) &
":" &
Mod(
DateDiff(
Start.SelectedDate + Time(Value(StartHour.Selected.Value), Value(StartMinute.Selected.Value), 0),
End.SelectedDate + Time(Value(EndHour.Selected.Value), Value(EndMinute.Selected.Value), 0),
Minutes),
60))
Any idea as to why the default condition won't work? I have tried many variations but no luck. I can provide more details if needs be.
Thanks.
Solved! Go to Solution.
Hi @Anonymous ,
Could you tell me what is the textbox?
Is a textinput control?
If so, you should use IsBlank to justify whether it is an empty value.
IsEmpty is used to justidy whether a table is an empty table.
Please try this formula:
If(!IsBlank(txtNumber.Text), Parent.Default, DateDiff( Start.SelectedDate + Time(Value(StartHour.Selected.Value), Value(StartMinute.Selected.Value), 0), End.SelectedDate + Time(Value(EndHour.Selected.Value), Value(EndMinute.Selected.Value), 0), Hours) & ":" & Mod( DateDiff( Start.SelectedDate + Time(Value(StartHour.Selected.Value), Value(StartMinute.Selected.Value), 0), End.SelectedDate + Time(Value(EndHour.Selected.Value), Value(EndMinute.Selected.Value), 0), Minutes), 60))
Best regards,
Community Support Team _ Phoebe Liu
Hi @Anonymous ,
Change If(!IsEmpty(txtNumber) to If(!IsEmpty(txtNumber.Text)
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogHi @Anonymous ,
If(IsBlank(txtTotalHours),DateDiff(Start.SelectedDate + Time(Value(Dropdown1.Selected.Value), Value(Dropdown1_1.Selected.Value), 0), End.SelectedDate + Time(Value(Dropdown2.Selected.Value), Value(Dropdown2_1.Selected.Value), 0), Hours) & ":" & Mod( DateDiff( Start.SelectedDate + Time(Value( Dropdown1.Selected.Value), Value(Dropdown1_1.Selected.Value), 0), End.SelectedDate + Time(Value( Dropdown2.Selected.Value), Value(Dropdown2_1.Selected.Value), 0), Minutes), 60),Parent.Default)
Hi @Anonymous ,
Could you tell me what is the textbox?
Is a textinput control?
If so, you should use IsBlank to justify whether it is an empty value.
IsEmpty is used to justidy whether a table is an empty table.
Please try this formula:
If(!IsBlank(txtNumber.Text), Parent.Default, DateDiff( Start.SelectedDate + Time(Value(StartHour.Selected.Value), Value(StartMinute.Selected.Value), 0), End.SelectedDate + Time(Value(EndHour.Selected.Value), Value(EndMinute.Selected.Value), 0), Hours) & ":" & Mod( DateDiff( Start.SelectedDate + Time(Value(StartHour.Selected.Value), Value(StartMinute.Selected.Value), 0), End.SelectedDate + Time(Value(EndHour.Selected.Value), Value(EndMinute.Selected.Value), 0), Minutes), 60))
Best regards,
Community Support Team _ Phoebe Liu
Hi there,
This seems to work quite well! Thanks for your solution.
User | Count |
---|---|
149 | |
94 | |
85 | |
78 | |
58 |
User | Count |
---|---|
193 | |
175 | |
104 | |
95 | |
91 |