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 / Update with Historical...
Power Apps
Unanswered

Update with Historical data

(0) ShareShare
ReportReport
Posted on by 209

Hello,

I am creating a power app which will manage long distance jobs issued to our fleet of vehicles.  On the whole it works apart from one problem which I can't seem to solve.  If a vehicle is issued a job and the driver then calls back to say he can't do the job for whatever reason I want the controller to be able to delete the job and for the car to be put back in it's original place in the queue before the job was issued to it.

 

I have 2 tables - The first table is 'Cars' which holds the list of cars - each car has its own individual number, (Column name: 'CALLSIGN') in the queue and the date of that vehicles last long distance job (Column Name: 'LASTROTA').

The second table is 'LDR' which holds all of the data from the completed jobs issued to the vehicles.  (Column name: 'VehicleNo' which is the same as 'CallSign'), 'DateAccept' is the date the job completed. I use table LDR to look up the Job History of a particular vehicle.  When a job is added to the PowerApp a button is pressed and it automatically adds the job to the LDR table (VehicleNo & DateAccept) and also patches the (CALLSIGN & LASTROTA) information into the table 'Cars'.- Works Perfectly !!

 

Now I need to create a Delete button that will totally remove a job from the LDR table for a selected vehicle AND Patch the previous job complete date for that vehicle into the 'Cars' table in the 'LastRota' column.

 

I am still new to using PowerApps so I'm not sure if this is at all possible or how I would even begin to start to do this so any help or suggestions would be very much appreciated.  The App on the whole works perfectly as I does a lot of other things so I really don't want to start from scratch if I can help it.

 

Categories:
  • Dawidvh Profile Picture
    1,346 on at

    Hi @Station1901

     

    Well done, sounds like a cool app.

     

    What part are you struggling with on the Delete and Patch for the following:

    "Now I need to create a Delete button that will totally remove a job from the LDR table for a selected vehicle AND Patch the previous job complete date for that vehicle into the 'Cars' table in the 'LastRota' column."

     

    To Delete, you can use RemoveIf

    RemoveIf(LDRTable,ID=IDToRemove)
  • Station1901 Profile Picture
    209 on at

    Thanks for getting back to me @DavesTechTips,  I'm ok with the delete record part I can get a button to delete a record in the LDR table but I want the same button to perfom 2 functions.  I need it to delete the record in the LDR table AND add the vehicles previous 'DateAccept' (stored in the LDR table) to the 'LastRota' column in the 'Cars' table.  If there is no previous job data to take from 'DateAccept' I will need 'LastRota' to be todays date (Now).

     

    The LDR table is the table that builds up and stores the Historical data for each vehicles jobs the 'Cars' table sorts the queue of vehicles based on the 'LastRota' date.

  • Dawidvh Profile Picture
    1,346 on at

    Hi @Station1901

     

    Consider the following:

    RemoveIf(LdrTable,Id=IdToRemove);
    
    Set(previousDate,Last(Filter(LdrTable,carID=applicableCarID)).dateToFetch);
    
    Patch(carTable,Lookup(carTable,ID=IdToUpdate),{DateField:previousdate})

    Let me know if this does work.

     

  • Station1901 Profile Picture
    209 on at

    Thanks again @DavesTechTips, Sorry I'm an absolute beginner at this.  The part RemoveIF has Id=IDToRemove.  Where does the ID part come from or what does this relate to?

  • Dawidvh Profile Picture
    1,346 on at

    Hi @Station1901,

     

    You mentioned that you are ok with removing the record, then you don't need the RemoveIf as you can merely use the method that you have been using to remove the record.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard