Skip to main content
Feb 6, 2023 10:39 PM UTC
Solved

SQL Code: DELETE using instance variable

I want to delete from a schema abcMySchema. 

In this schema I am storing the Label of the workflow: MyWorkflow.

I have added a SQL Code Action: DELETE FROM abcMySchema WHERE sWorkflowName = <%= instance.label %>;

 

I am getting the following errors:

PGS-22000 PostgreSQL error: ERROR: column "myworkflow" does not exist...

WDB-200001 SQL statement 'DELETE FROM abcMySchema WHERE sWorkflowName = MyWorkflow' could not be executed.

 

I can hardcode the value WHERE sWorkflowName = 'MyWorkflow' and the query runs and deletes the associated records.

 

How do you use the dropdown instance > label in a query?

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Amine_Abedour
Amine_AbedourAccepted solution
Community Advisor and User Group Leader
Feb 7, 2023 3:46 PM UTC

Hello @tjforce24 ,

 

Try this : 

DELETE FROM abcMySchema WHERE sWorkflowName = '<%= instance.label %>';

 

Br,

Amine

Amine ABEDOUR

2 replies

Amine_Abedour
Community Advisor and User Group Leader
Amine_AbedourCommunity Advisor and User Group LeaderAccepted solution
Community Advisor and User Group Leader
Feb 7, 2023 3:46 PM UTC

Hello @tjforce24 ,

 

Try this : 

DELETE FROM abcMySchema WHERE sWorkflowName = '<%= instance.label %>';

 

Br,

Amine

Translate
Amine ABEDOUR
tjforce24Author
Feb 7, 2023 3:58 PM UTC

I thought I tried this since it is a string and was getting errors.  This worked for me.  Thanks.

Translate