Deleting records by record id

  • 0
  • 2
  • Question
  • Updated 1 year ago
  • Answered
I am updating my tables for the last time but I have noticed I have around 65 records which should not be there.  What is the quickest way to delete this.  I do have their record ID.  There is no other criteria available to me unless to find each record and delete it. 
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb

Posted 3 years ago

  • 0
  • 2
do you have a list of these record ID's in Excel?
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,224 Points 20k badge 2x thumb
If you know the rids you can generate the query using some script entered into the console:

var rids = [4,56,100,677];
var query = "&query={3.EX." + rids.join("}OR{3.EX.") + "}";
console.log(query);

output:

&query={3.EX.4}OR{3.EX.56}OR{3.EX.100}OR{3.EX.677}
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
Yes, I do.
If you have these record ids in excel you can make a formula like this

1234 OR 2345 OR 4567

Then paste that into the filter criteria for a report.
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
Pl take me through a little more detail. Is this the function I create?
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,224 Points 20k badge 2x thumb
Press F12 to expose the Developer Tools. Then paste my code into the console tab.. Copy out the &query output and paste it into the address bar of an existing URL.

I live in the Developer Tools and only enter things into QuickBase when they work in the console.
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
I tried to add all record ids.

var rids = [4804,6293,5338,9105,8192,7179,7620,6787,7604,8810,7775,7608,8813,8586,8635,8238,8999,8397,7194,7959,9173,7293,9165,8684,9081,7564,7976,9223,7299,9192,8648,8865,7796,7720,7773,8551,7193,8352,8821,8837,8602,7659,8355,9151,9212,8866,8631,8658,9178,7151,8400,7841,8685,8870,7644,9126,9107,7489,9136,8388,10533,7279,8637,9153,8391];
var query = "&query={3.EX." + rids.join("}OR{3.EX.") + "}";
console.log(query);


When I pasted in the address bar it takes me to Google.
... well if you are going to do that, then whjy not just do this my method and paste that into the filter for a report.

Where [Record ID#] equal to  

1234 OR 2345 OR 4567

The OR must be in upper case
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,224 Points 20k badge 2x thumb
Without using JavaScript I don't see the point.
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
Thanks both.  I managed to delete these records using Mark's technique. But Dan's solution is good.  I am little apprehensive of deleting  in this manner as I really don't know what am I doing.  I am at a crucial stage as I am rolling out and just cannot afford any issues.  Will definitely learn few things from you Dan.
:)
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,224 Points 20k badge 2x thumb
It is Mark that I am worried about. He really has to get on the JavaScript train.
Photo of Anthony

Anthony

  • 10 Points
So not sure if this is relevant but I found this thread when wanting to delete a list of record ids. 

I have table structure of opportunities -> Facilities -> Asssets. 

I had a list of assets that I wanted to delete from an opportunity but not all assets associated with that opportunity (567 of them). I tried this method and it was to tedious in excel to write the formula with all the record id's to find them. What I did instead was move all the facilities that had the assets I wanted into a new opportunity. Then deleted all the assets associated with the original opportunity. Then I can move all the facilities with assets I want back into the original opportunity.  I know this is not exactly what this thread is about. But think of it like figuring out a way to be able to create a filter for the records you want to delete. I did this by moving all the records to be associated with another parent table record and then deleting. So taking the list excel list of record IDs, running an update, then a report and grid edit to delete. Hope this helps. 
(Edited)