Forum Discussion
That's the solve for now, though I used a webhook instead of a pipeline so it would happen instantly. I used a button push instead of a checkbox, so they are forced to delete one by one.
------------------------------
Mike Tamoush
------------------------------
Can you post your multi record webhook code? It mjkst use the Repeat On syntax?
------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------
- MikeTamoush2 years agoQrew Commander
Since I am forcing a button push, I used API_DeleteRecord which is pretty simple, but wont work for multi record. However, I was just watching the Kirk Trachy video, and think I know what the code would be for multi delete. Ill post it shortly let me grab it.
------------------------------
Mike Tamoush
------------------------------ - MikeTamoush2 years agoQrew Commander
Below is my best guess, but untested. It would use API_PurgeRecords (rather than API_DeleteRecord). I tried to adapt using what is at the 10 minute mark in this Kirk video.
https://www.youtube.com/watch?v=-eY6ZAivCZY
In his video he is not deleting the record that triggered it, but rather a related record. Also, in the middle of his explanation he realizes he has an error, and has duplicated some of the code. But he doesnt fix it on video, so I am using my best guess on how it would work. Worst case, we can duplicate his 'error' because his actually still works, it is just not clean code.
<qdbapi>
<usertoken>enter user token here</usertoken>
<apptoken>enter app token here</apptoken>
<udata>mydata</udata>
<query>
%RepeatOn%{'3'.EX.[Record ID#]}%RepeatOff%
</query>
</qdbapi>
**Also, I would test this in a test environment, as the API help page says if there is no query, all records in the table will be deleted. Not sure what happens if your query just isnt right.....but seems risky for sure so use with caution.
------------------------------
Mike Tamoush
------------------------------- ShawnS3 months agoQrew Member
In case anyone ends up here looking for a similar solution here is what worked for me:
<qdbapi>
<usertoken>user token</usertoken>
<apptoken>apptoken</apptoken>
<query>
{3.EX.[Record ID#]}%RepeatOn%OR{3.EX.[Record ID#]}%RepeatOff%
</query>
</qdbapi>From the documentation %RepeatOn% repeats what's inside it. So:
<query>
%RepeatOn%{'3'.EX.[Record ID#]}%RepeatOff%
</query>results in:
<query>
{'3'.EX.[Record ID#]}{'3'.EX.[Record ID#]}...for however many records
</query>While:
<query>
{3.EX.[Record ID#]}%RepeatOn%OR{3.EX.[Record ID#]}%RepeatOff%
</query>results in:
<query>
{3.EX.[Record ID#]}OR{3.EX.[Record ID#]}OR{3.EX.[Record ID#]}....
</query>Since this only triggers once you need the logical OR in the resulting repeated list to make sure you match any and all of the Record IDs. It took me too long to realize what RepeatOn is doing and how that interacts with building a query string with more than one condition.
Good news is that doing it the incorrect way did not purge my whole table. I'm still building my app so there was only test data at risk.
- MarkShnier__You2 years ago
Qrew Legend
I have used API_PurgeRecords in an URL formula button and forgot to add the &qid=.... and from experience I can confirm that you can accidentally (but very efficiently) purge a whole table.
------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------