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.
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)
Thanks for getting back to me @Dawidvh, 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.
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.
twitter: @dawidvh
youTube: https://www.youtube.com/channel/UCIMe_ErQZP5chbI9UyW0xLw
Thanks again @Dawidvh, 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?
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.
User | Count |
---|---|
137 | |
127 | |
75 | |
72 | |
69 |
User | Count |
---|---|
222 | |
135 | |
78 | |
58 | |
54 |