Hi Experts,
I have an app with 7x TextInput fields. One of them displays the date and time now (as below)
TextInputTime
Text(Now(),"[$-en-GB]dd/mm/yyyy hh:mm:ss","en-GB")
The other 6x fields will have the below shown in them.
TextInput1
3 days
TextInput2
1 day
TextInput3
8 hours
TextInput4
5 hours
TextInput5
2 hours
TextInput6
30 minutes
What i'm wanting to do is add the timing displayed in TextInput1 - TextInput6 based on the selection of a dropdown made previously to the TextInputTime field by doing something like:
If('Dropdown-Impact'.Selected.Value = "Nobody Affected", TextInputTime.Text,
'Dropdown-Impact'.Selected.Value = "Only Affecting One Person", TextInputTime.Text,
'Dropdown-Impact'.Selected.Value = "Affecting Group of People", TextInputTime.Text,
'Dropdown-Impact'.Selected.Value = "Affecting a Department", TextInputTime.Text,
'Dropdown-Impact'.Selected.Value = "Affecting Entire Business", TextInputTime.Text
)
Please help, thanks in advance
Dave
Hi @ppDev_30 ,
I've managed to sort my issues by amending the code as per the below:
"Nobody Affected", DateAdd (Text(Now(), "[$-en-GB]dd/mm/yyyy hh:mm:ss","en-GB"), Value(Left(NobodyAffectedRespSLA.Text, 1)), Mid(NobodyAffectedRespSLA.Text, Find(" ", NobodyAffectedRespSLA.Text) + 1)),
Thanks again for your help
Regards
Dave
Hi @ppDev_30 ,
This has worked perfectly thank you. The only issue that I have is that the date is showing in American format, do you know how I can adjust the code to change it to UK format please DD/MM/YYYY?
Currently showing as
Thanks again
Dave
Hi @Dave-ITMan, please try this switch condition code
Switch(
ddType.Selected.Value,
"Nobody Affected", DateAdd(Now(), Value(Left(Label1.Text, 1)), Mid(Label1.Text, Find(" ", Label1.Text) + 1)),
"Only Affecting One Person", DateAdd(Now(), Value(Left(Label1_1.Text, 1)), Mid(Label1_1.Text, Find(" ", Label1_1.Text) + 1)),
"Affecting Group of People", DateAdd(Now(), Value(Left(Label1_2.Text, 1)), Mid(Label1_2.Text, Find(" ", Label1_2.Text) + 1)),
"Affecting a Department", DateAdd(Now(), Value(Left(Label1_3.Text, 1)), Mid(Label1_3.Text, Find(" ", Label1_3.Text) + 1)),
"Affecting Entire Business", DateAdd(Now(), Value(Left(Label1_4.Text, 2)), Mid(Label1_4.Text, Find(" ", Label1_4.Text) + 1))
)
This code finds the value you wanted to add in the date
Value(Left(Label1.Text, 1))
While this code will find the time units you wanted to use (Days, Hours, Minutes)
Mid(Label1.Text, Find(" ", Label1.Text) + 1)
I have tested it on my end and it works, I've included screen for your reference.
Hope this helps!
Hi @ppDev_30 ,
Thanks for the reply. That is saying that .Days isn't recognized which I think is because the original date in TextInputTime has been converted to text in order to display correctly in UK time as it keeps pulling through American time.
Regards
Dave
Hi @Dave-ITMan, I think the easiest way to do achieve your requirement is by using DateAdd native function of Power Apps.
You can try the following code to test and try to experiment that will align to your requirements:
DateAdd( Now(), 3, TimeUnits.Days )
Hope this helps!
WarrenBelz
146,651
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional