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.

Hi,

I am also having this kind of issue when we migrate from old prod server to a new one.

Everything was running normal from the old server but after the migration, we always having this issue from the new one.

ASQL:

Error Message:
(DELETE FROM {negativebalancewireless} WHERE {negativebalancewireless}.[date_generated] = @DateGenerated AND {negativebalancewireless}.[generatedby] = @GeneratedBy; COMMIT;): Key cannot be null. Parameter name: key


Any help will be highly appreciated.