Skip to main content
New Member
Jan 29, 2021 1:13 PM UTC
Solved

Dropping Data from a Temp Table

Hi,

 

I have a continual delivery workflow that is looking for an External signal to activate.

As part of the workflow, I pull in a List for lookups against c1.4 million rows. Not ideal but best way of circumventing an issue. 

The workflow runs and sends the emails.

However the list never seems to get dropped but holds the data in a temp table (temp:readGroup). Is there anyway of dropping this data via a JS node once the email has sent? It's putting strain on the server since the workflow never really 'ends' continually eating memory when not needed etc.

Hope that makes sense!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Manoj_Kumar
Manoj_KumarAccepted solution
Community Advisor
Jan 30, 2021 8:20 AM UTC

Hello @tarquinius ,

 

First open the list and get the SQL table name from the content tab.

 

The you can use this code in the JavaScript activity in the end of the workflow:

sqlExec("TRUNCATE TABLE TABLE_NAME_HERE");

 

Thanks,

Manoj

 

 

Manoj  | https://themartech.pro

6 replies

adithyacs86
Level 5
Jan 29, 2021 1:36 PM UTC

Hi @tarquinius , 

 

If I understand correctly,  we have the OOTB functionality in the List Update activity to purge the list entirely. 

 

which can be used after the delivery is sent out.

 

Thanks,
Adithya

Translate
New Member
Jan 29, 2021 1:40 PM UTC

Thanks for the response @adithyacs86 

Sorry. I may not have explained myself very well though! 🙂

 

The list is reused over and over each time the workflow is triggered. The problem is when the data is loaded into a temp table within the workflow, it's not getting dropped once the workflow has completed (probably because the workflow has a continual delivery and therefore never truly 'ends'). I don't want to purge the list - just the temp list load from the workflow (temp:readGroup by the looks of it).

 

I was hoping there might be a bit of JS code I could use in a node to simply purge the data in the table (temp:readGroup).

 

Thanks

Translate
adithyacs86
Level 5
Jan 29, 2021 2:01 PM UTC
Hi Again, Sorry I misread the details, thanks for clarrifying, yes I think you can use either SQL code activity or the write sql script in the JS activity after the delivery activity to delete the temp table, like "DELETE FROM vars.tableName;" this would delete the entires in the temp table.
Translate
Manoj_Kumar
Community Advisor
Manoj_KumarCommunity AdvisorAccepted solution
Community Advisor
Jan 30, 2021 8:20 AM UTC

Hello @tarquinius ,

 

First open the list and get the SQL table name from the content tab.

 

The you can use this code in the JavaScript activity in the end of the workflow:

sqlExec("TRUNCATE TABLE TABLE_NAME_HERE");

 

Thanks,

Manoj

 

 

Translate
Manoj  | https://themartech.pro
Sukrity_Wadhwa
Level 4
Feb 2, 2021 11:53 AM UTC

Hi @tarquinius,

Were you able to resolve this query with any of he given solutions or do you still need more help here? Do let us know.

Thanks!

Translate
Sukrity Wadhwa
saikatk2447661
Level 4
Feb 10, 2021 5:53 PM UTC

Hi @tarquinius ,

 

  1. Put an end block after cont. delivery block.
  2. Use this in the advanced tab of end block:
sqlExec("drop TABLE "+vars.tableName);

vars.tableName with contain the temp table name that gets created in backend database. It will have name like wkf1163548174_64_1

 

Thanks,

Saikat

 

Translate