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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Search SharePoint List...
Power Apps
Answered

Search SharePoint List and Display last value entered

(0) ShareShare
ReportReport
Posted on by 39

Hello Everyone,

 

Sorry, I'm new to development and PowerApps and have a question for the community. 

 

I'm currently, working on an app for our company in which form entries are automatically collected and stored in a Sharepoint list.  Each entry has a unique identifier column and for any new entry we would like to collect the previous entry for that unique identifier.

 

For Example:

User1@contoso.com submits an entry for vehicle VIN (Unique Identifier) and then opens the form later on to submit another entry for that same VIN.

User2@contoso.com  submits an entry for vehicle VIN (Unique Identifier) and then opens the form once again to submit another entry for the same VIN.

 

DateEmailVIN (Unique Identifier)Starting Mileage
08/03/20user1@contoso.comXXXX12345,000
08/03/20user2@contoso.comXXXX43258,000
08/04/20user1@contoso.comXXXX12345,050
08/04/20user2@contoso.comXXXX43268,200

 

Is it possible to for PowerApps Form entry to automatically pull the previous information for that VIN (Unique Identifier).

 

For example:

New Form Entry:

DateBlank
EmailBlank
Vehicle VIN (Unique Identifier)Select
Starting Mileage:

If the above VIN is selected, look at the last entry submitted for that VIN and display value here.

 

 

 

Is this possible?

 

Thank you,

 

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @masterp 

    First, when you say "Form" - are you actually using an EditForm?  If so, then you will have this ability built in.

    If this is a custom form, then you will need to provide that functionality yourself.

     

    Usually, you will have some sort of Gallery, DropDown, Table, etc. that you are selecting the vehicle from.  Let's say in this case it is Gallery1.

     

    For your fields on your form then you will be able to use these formulas on the Default properties of your text input controls (This one for Starting Mileage):

    First(
     SortByColumns(
     Filter(yourDataSource, VIN=Gallery1.Selected.VIN),
     "Date", Descending
     )
    ).'Starting Mileage'
    

    This will filter the data by the unique VIN and then sort by the dates and then take the First (in this case sorting descending, so the first it the last) and then use the property associated with it.

     

    I hope this is helpful for you.

  • masterp Profile Picture
    39 on at

    @RandyHayes 

     

    Yes, I'm using EdithForm and not a custom form and I have a dropdown DataCardValue.  Well hope that makes sense. 🙂

     

    Also, thanks for the quick reply but unfortunately my code is not working. Below are my values:

     

    The Table (SharepointList) containing date is = Vehicle.Mileage.Report_1

    The column with date and time on table Vehicle.Mileage.Report_1= Title

    The column containing the VIN = Vehicle Vin_DataCard1

    The selection is made on = Datacardvalue4

    The result will need to go to = Datacardvalue1

     

    This how i plugged the information you provided.

     

    First(
    SortByColumns(
    Filter([@'Vehicle Mileage Report_1'],'Vehicle VIN'=DataCardValue4.Selected.Value,
    "Date", Descending
    )
    ).'Beginning Mileage'

     

    Also, how can I enter a "0" value if none is found?

     

    Thank you,

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @masterp 

    So if you are using an EditForm, then it is already tied to all the values.  All you need to do is provide the Item for it to display/edit.  This is done through the Item property of the form.

    Again, if you have a gallery where you are selecting these vehicles, then you can set the Item property to yourGallery.Selected

     

    If that is not the case, then tell me more about your scenario. 

     

    I am not sure what you mean by "how can I enter a "0" value if none is found?".  Can you elaborate? 

     

  • masterp Profile Picture
    39 on at

    @RandyHayes 

    Yes. I don't have a gallery for the selections.  My Vehicle VIN selections are coming from a SharePoint List as a drop down entry. Please view the image below for additional information.  I know I am not using the right terminology but hoping that the picture displays what we're trying to achieve.

     

    I was able to modify your code and add one entry but it shows the same entry for all Vehicle VINs selected and unfortunately this will not work since every Vehicle VIN has a different beginning mileage entry.

     

    This is the code that filters and shows entry.

     

    First(
    SortByColumns(
    Filter([@'Vehicle Mileage Report_1'],DataCardValue4="1GNXXXXXXXXX4883"),
    "Title",Ascending
    )
    ).'Beginning Mileage'

     

     

     

    VehicleMileageImage.jpg
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @masterp 

    So it appears that you have an EditForm and you have modified the first datacard with a ComboBox to show vehicle VINs from the same list or a different list?

  • masterp Profile Picture
    39 on at

    @RandyHayes 

     

    All data is coming from the same Sharepoint List this includes the dropdown items. 

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @masterp 

    Okay...almost there.  What is the Items property of your ComboBox?

  • masterp Profile Picture
    39 on at

    @RandyHayes 

     

    The code for the items property is:

    Choices([@'Vehicle Mileage Report_123'].VehicleVIN)

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @masterp 

    Okay, then your Default property on the DataCard for Beginning Mileage should be:

    Coalesce(
     First(
     SortByColumns(
     Filter('Vehicle Mileage Report_123','Vehicle VIN'=DataCardValue4.Selected.Value,
     "Date", Descending
     )
     ).'Beginning Mileage',
     0
    )
    
     

    Your Default property for DataCardValue1 (I believe that is the control you have in your Beginning Mileage datacard) should be : Parent.Default

     

     

  • masterp Profile Picture
    39 on at

    @RandyHayes 

     

    I entered the code to my Card : Beginning Mileage DataCardValue1 to Default as:oalesce(
    First(
    SortByColumns(
    Filter('Vehicle Mileage Report_1','Vehicle VIN'=DataCardValue4.Selected.Value,
    "Date", Descending
    )
    ).'Beginning Mileage',
    0
    ))

     

    I added ) to the end I thing it was missing but let me know if it wasn't.  Unfortunately, the code is not working.  My Card: Beginning Mileage is still empty and I do have entries for that Vehicle VIN.  

     

    Thank you for all your help. 

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard