Skip to main content
1-Visitor
April 22, 2019
Question

delete multiple rows in database

  • April 22, 2019
  • 9 replies
  • 3608 views

Hi,

I wanted to delete multiple rows in sql database. I have given the input as infotable which has default datashape that I have binded the grid to. The grid data selected rows I am giving as input to the multi delete service infotable ip. I tried using the grid advanced but the code does not work.

The Things["Bobcat_DBConfig"].Delete_Organization(params) is the service which has sql query to delete the row (

WITH cte AS
(
SELECT ROW_NUMBER() OVER(ORDER BY org_id) AS Row
FROM Organization
)

DELETE FROM cte
WHERE Row = [[rowNum]] )

 

multidelete.pngHow could I resolve this? 

 

Thanks in advance,

Shalini V.

9 replies

5-Regular Member
April 23, 2019

Are you deleting data from Datatable (js service) or External Database (sql command)?

 

The Thing in your screen shot is a Datatable, but you mentioned sql database a lot.

 

If you want to delete multi-row in Datatable, use the 

DeleteDataTableEntries / DeleteDataTableEntriesWithQuery service
 
1-Visitor
April 24, 2019

Hi @zyuan1 ,

I wanted to multi delete the data in external database using multi select option in advanced grid. 

5-Regular Member
April 24, 2019

The advanced Grid widget will send out infotable result. Check what infotable you'll get, and then use this infotable as input to trigger the SQL commands.

 

SQL command usually receive 1 row of data each execution, so you may need a Javascript to iterate each row of infotable and trigger the SQL command, make it a loop.