Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic Delete

Hello Everyone,

I have implemented dynamic update to insert a record within a table or field. But I want to delete not all data but data which is last inserted into the table.is this possible by Dynamic Update ?

to delete the field value I used following delete command


DELETE FROM TestTable WHERE -1


where TestTable is the name of the Table.

12 Replies
SunilChauhan
Champion
Champion

DELETE FROM TestTable WHERE  peek('Tablename',-1,'keyfieldnameorID');



Sunil Chauhan
SunilChauhan
Champion
Champion

DELETE FROM TestTable WHERE ID=Max(ID);

Sunil Chauhan
Not applicable
Author

it wont work

SunilChauhan
Champion
Champion

DELETE FROM TestTable WHERE modifieddate=Max(modifieddate);

Sunil Chauhan
its_anandrjs

Hi,

I believe DELETE is not supported by qlikview you can achieve this by another resident load table see the example load script

You use this expression in the SQL

DELETE FROM TestTable WHERE -1

Not applicable
Author

but this syntax delete all the table data,I want to delete last inserted data.

its_anandrjs

Try this way suppose there us table and store last record value in the variable r if you have Primary key then use that key

Ex:-

Table1:

LOAD * Inline

[

City,Sales

A, 343454

B, 15482

C, 125659

D, 15823

E, 12563

];

LET vLast = Peek('City' ,-1, 'Table1'); //Here in example last row is E,12563 so we have to delete it from table

NoConcatenate //Then load this resident load without last row

LOAD

City,Sales

Resident Table1

Where not City = '$(vLast)';

DROP Table Table1;

Note:- Load only previous values except the last row.

Hope this helps

Not applicable
Author

This is possible on script editor right,But my requirement is to delete from user interface,I am asking is this possible or not?

its_anandrjs

Hi Bhawana,

Which version of QV you are using.

Thanks