Hello All,
I am trying to create a mileage log app. Employee can add their mileages.
You can see the screenshot below.
My question is this:
I have a filed called Total Mileage which summing up the total mileage column’s value.
The app retrieving data form SharePoint list.
When the Total Milage value is equal or less than 10.000, I want the payment option dropdown filed value to be/shown 0.45 option value otherwise the option value should be 0.25.
Total Mileage =Sum ('Mileage Log','Total Mileage')
Mileage Log is the list name in SharePoint.
If the total mileage=SUM (end mileage- start mileage)
Hope some of you would be able to come up with a solution.
Thank you in advance.
Kind Regards
Solved! Go to Solution.
Hi @Anonymous,
Generally, you could set the Items as
Choices([@'Mileage Log'].'Payment Options')
, and set the DefaultSelectedItems property as your If() statement.
If your issue has been solved, please mark my solution as answer.
Thanks for your co-operation.
Hi @Anonymous,
Could you please tell me that how you set the Items property of the payment option dropdown?
Do you want to filter the payment option dropdown filed value based on the Total Mileage result?
Not sure about the column type of the Payment Option column, Choice or Text?
I assume that it is a Choice column type, please check the following formula.
Set the Items property of the payment option dropdown as below:
If(Sum(TextInput_StartMileage.Text,TextInput_EndMileage.Text)<=10,
Filter(Choices('Mileage Log'.'Payment Options'),Value="0.45"),
Filter(Choices('Mileage Log'.'Payment Options'),Value="0.25")
)
Hi @Qi ,
Thanks very much for your reply.
The "Payment Options" is choose column/filed and has two values/options: 0.45 and 0.25. Please see the screenshot below.
The total mileage text string is: Sum('Mileage Log','Total Mileage') and the name of the label is: LabelTotalMileage
The following code is working but it hides one of the value (0.45 or 0.25) based on 600 and user still has to select the value from dropdown option.
If(Sum('Mileage Log','Total Mileage')<=600,
Filter(Choices('Mileage Log'.'Payment Options'),Value="0.45"),
Filter(Choices('Mileage Log'.'Payment Options'),Value="0.25")
)
Is there any way, the value can automatically be populated into the filed rather than the user has to choose it.
Thanks again.
Hi @Anonymous,
Please try to set the DefaultSelectedItems property as below:
If(Sum('Mileage Log','Total Mileage')<=600,
Filter(Choices('Mileage Log'.'Payment Options'),Value="0.45"),
Filter(Choices('Mileage Log'.'Payment Options'),Value="0.25")
)
Thanks @Qi , That worked nicely. I assume that I do NOT need to "Set the Items property" value to.
If(Sum('Mileage Log','Total Mileage')<=600,
Filter(Choices('Mileage Log'.'Payment Options'),Value="0.45"),
Filter(Choices('Mileage Log'.'Payment Options'),Value="0.25")
)
I can leave it as default value which is : Choices([@'Mileage Log'].'Payment Options').
Best Wishes
Hi @Anonymous,
Generally, you could set the Items as
Choices([@'Mileage Log'].'Payment Options')
, and set the DefaultSelectedItems property as your If() statement.
If your issue has been solved, please mark my solution as answer.
Thanks for your co-operation.