How to Clear Data from user defined entity

Hi guys,

I have an entity name stored in an variable, then i want to clear that entity record.

So i tried to use SQL widget. However my solution is not work. An error was encountered.

Here is my SQL Scripts and error message:

First one:

Second one:

You don't need BEGIN/END, just DELETE and COMMIT.

Hi Ding,

If you want delete data from entity you should use -

like

Delete from {ENTITY_NAME}

After that use CommitTransaction Action

If you as a Parameter entityname

use

Delete from @entityName and set this parameter property escape content yes and prvoide this entity name like 

"{EntityNmae}"

Hope this will help


Kind Regard

Rahul Sahu

Rahul Sahu wrote:

Hi Ding,

If you want delete data from entity you should use -

like

Delete from {ENTITY_NAME}

After that use CommitTransaction Action

If you as a Parameter entityname

use

Delete from @entityName and set this parameter property escape content yes and prvoide this entity name like 

"{EntityNmae}"

Hope this will help


Kind Regard

Rahul Sahu


Hi Rahul,

I tried your solution, Although record were be deleted successfully, But i also encountered another exception, said "Error executing query".

Here is the error message, copied from management console of my OutSystems environment:

Error executing query. Error in advanced query SQL1 in TruncateTable in OSMDB_Core (DELETE FROM @tableName;  COMMIT;): Key cannot be null.
Parameter name: key

And I'm Sorry for late reply.

Hi Ding weibing,

After viewing the above snips , states that you are using "Delete from @EntityName" and Delete from [@EntityName]  where EntityName is just a parameter which doesn't seem meaningful

If you just want clear the Local Variable create a variable named EntityName_Clear and once the operation is done use Assign statement with EntityName=EntityName_Clear.