web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Create an automised pr...
Power Apps
Unanswered

Create an automised process for Kilometers - Car Rental App

(1) ShareShare
ReportReport
Posted on by 23

Hello,

I am having some sort of issue/doubt in regards to making a field automised for my PowerApp. I have connected two Sharepoints, one that has the filled in Forms and another with a List of all vehicles that are being used by the company.
A user basically sends a form with the first information, then the person assigning the vehicle with their user, sees the previous information (name, type of vehicle etc.) Key here is that the Type of Vehicle Column is a Lookup column in the Car Rental List (The one with the filled in and sent forms), that takes information from the FLOTA ESPANA VEHICULO list (Where the list of vehicles is) It works fine and I have no problems as then the next 3 datacards, also Lookup columns named Make, Model and Registration Number, are filtered by the previously chosen Type of Vehicle. 

But..
When the user again goes back into the form to see more information (Formulario 2 button that unhides the next fields to enter in the app) I dont know how I can automise the Initial Kilometres so when the next person enters the app, and happens to get the same car, they see the previously entered Final Kilometres as the new Initial Kilometers (which is a lookup column also). I have no errors in the code that I will share below but I see nothing, also I tried many different data types, Text Label, Combo box etc and with no solution. I would preferably want a combo box to keep the consistency. 

 Update properties of the Initial Kilometres:
{
    Id: LookUp(
        'FLOTA ESPAÑA VEHÍCULOS',
        Marca = DataCardValue68.Selected.Value &&
        Modelo = DataCardValue70.Selected.Value &&
        Title = DataCardValue69.Selected.Value,
        ID
    ),
    Value: LookUp(
        'FLOTA ESPAÑA VEHÍCULOS',
        Marca = DataCardValue68.Selected.Value &&
        Modelo = DataCardValue70.Selected.Value &&
        Title = DataCardValue69.Selected.Value,
        Kilometros
    )
}

Items property:

LookUp(
    'FLOTA ESPAÑA VEHÍCULOS',
    Marca = DataCardValue68.Selected.Value &&
    Modelo = DataCardValue70.Selected.Value &&
    Title = DataCardValue69.Selected.Value,
    Kilometros
)
 
Title is the Matricula or Registration Number Column in the list
Kilometros is the Initial Kilometers from the same list

I want it so I can send and update the Car Rental Sharepoint list as the other columns worked using lookup but with this last one I am having issues..
Categories:
I have the same question (0)
  • stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    some suggestions:
    1.  If you want to use combox, consider wrapping the lookup result in a table() function, then set both its item and DefaultSelectedItems.
      and configure DisplayFields to show the correct property.
    2. check the data type.  use Text() when needed.
    3.  use Lookup, it only gives/returns one result, is that what you want ?
  • MrKevin Profile Picture
    23 on at
    @stampcoin Hi, 

    Just to maybe make it easier to understand, for the previous step, where I filter the Make, Model and Registration Number by the Type of Vehicle field, here is the code for the Make datacard properties:

    Update = 
    {Id: LookUp('FLOTA ESPAÑA VEHÍCULOS', Marca = DataCardValue60.Selected.Value, ID),
    Value: DataCardValue60.Selected.Value
    }
    Items = 
    Distinct(
        Filter(
            'FLOTA ESPAÑA VEHÍCULOS',
            Flot.Value = "Activo" &&
            Tipo = ThisItem.'Tipo de vehículo\Numero de plazas'.Value
        ),
        Marca
    )

    This works and updates the Car Rental Sharepoint list properly with the chosen data from the app.

    I want something similar for the Initial Kilometers, to be filtered, but this time by the Make, Model and Registration number, so it corresponds to that specific car and is then automised for the next person, to then make the Final Kilometers the Inital one.
    Hope I made myself clear and helped out a bit.
  • stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
     Hi,
    Just want to get more detail from you :
    Let's assume UserA gets one car, Initial Kilo = 0km, after the car returned from UserA, the final value= 100km.
    Then for next UserB, do you want to assign 100km as this one's initialized value ?
     
  • MrKevin Profile Picture
    23 on at
    @stampcoin Exactly! That is what I would like to implement into the app 
  • MS.Ragavendar Profile Picture
    4,983 Super User 2025 Season 2 on at
     
    If A took Benz with 0 Km and returning benz with 150 kms and If B takes the same vehicle it should start from 150Km.
     
    Consider this as baseline, I hope you have created one column in the backend (sharepoint list) as Final Km and patching the value against it.
     
    Lookup(SortByColumns(Filter('Datasource, Title=
            Title = DataCardValue69.Selected.Value),"Created",Descending),true,'Final Kilometres')
     
    Title - Reg No of vehicle 
    Created - default sharepoint column used for sorting.
     
     
    I believe the column type is number in the backend.
     
     
    🏷️ Please tag me @MS.Ragavendar if you still have any queries related to the solution or issue persists.
    Please click Accept as solution if my post helped you solve your issue and help others who will face the similar issue in future.
    ❤️ Please consider giving it a Like, If the approach was useful in other ways.
  • stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    One thing want to know that the below code (from you), are you sure the result is unique ? if you have more than one records from your list, it may not get the correct one. ( it will return the first find).
     
    LookUp(
        'FLOTA ESPAÑA VEHÍCULOS',
        Marca = DataCardValue68.Selected.Value &&
        Modelo = DataCardValue70.Selected.Value &&
        Title = DataCardValue69.Selected.Value,
        Kilometros
    )
    Then,
    In your 'FLOTA ESPAÑA VEHÍCULOS' list, you may consider to use another field to save the initialzed kilometers.
    Lets call it InitialzedKm, ReturnedKm.( both will be 0 in the very beginning: new car/new asset)
    • InitialzedKm, when User A summit the form, initialized value =0. (assume this is new car).
    • ReturnedKm, when User A return then car, it will have a value, let assgin it =100, you update this column after the return.
    • when User B tries to apply this car, you will fetch the value from ReturnedKm=100 for Kilometer(on the UI).
    • Once User B gets confirmation, then you have to update the InitialzedKm = RetrunedKm, which is 100.
    hope that make sense to you.
    •  
     
  • MrKevin Profile Picture
    23 on at
    I understand, let me share with you what the 'FLOTA ESPAÑA VEHÍCULOS' list looks like:

    As you see, this is where I want to take the 'Initial Kilometers' from, as you see the Kilometros Column has the Initial Kilometers set here.
    I want to take this columns data to be the Initial Kilometers at first and be filtered by the selected car from the user.

    So I want the app to filter by the Marc, Model del coche & Matricula fields, to show the Inicial Kilometers of the selected car, of course being different depending on each car, and then, on the bottom I have Kilometros Llegada (Final Kilometers) to be entered by the user. 
    I'm guessing both will have to work together and make it work?
    Here is the main database of the sent forms:
  • stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    Yes, you have to use the 'Car Rent' list , column with final kilometer, and update your FLOTA ESPAÑA VEHÍCULOS' with another column.
    Other you have check  'Car Rent' list each time, like @MS.Ragavendar said. You code will query against two list.
    I suggest use a separated colum in FLOTA ESPAÑA VEHÍCULOS', then your code only query against this list.
     
  • MrKevin Profile Picture
    23 on at
    @MS.Ragavendar 

    If I understand correctly, I should have a Final Kilometers in the 'FLOTA ESPAÑA VEHÍCULOS' and have it patch to that column, and then have the Final Kilometers from the main 'Car Rental' list to take the information in that order? I just want to have it correct and also the code you have mentioned, should be placed in the Final or Initial datacard?

     
  • MS.Ragavendar Profile Picture
    4,983 Super User 2025 Season 2 on at
     
    I should have a Final Kilometers in the 'FLOTA ESPAÑA VEHÍCULOS' and have it patch to that column, and then have the Final Kilometers from the main 'Car Rental' list to take the information in that order - Exactly you are correct
     
     
    I just want to have it correct and also the code you have mentioned, should be placed in the Final or Initial datacard?
     
    It can be based on your requirement, In the image you have added only the Initial card alone right ( label control), you can place in that itself, since it read only field..
     
    🏷️ Please tag me @MS.Ragavendar if you still have any queries related to the solution or issue persists.
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard