"You should enter only a single query in a row." ???

I have this query

delete from PLSM_note where noteId in (fn!substitute(fn!joinarray(ac!selectedRecordIds, ";"),";",","))

as shown in the below image.

This query should translate to:

delete from PLSM_note where noteId in (1,2,4,50)

However, I'm getting this message

A) This is all on a single row
B) This is a single query

What's the solution to this?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Why in the world are you using the Query Database node to do this?!  Please please please just use the "Delete from DSE" node.  The QDB node should be used only in extreme circumstances, and even then I always recommend trying all other approaches first.

    Anyway the actual answer to your question: the SQL statement consumed by this node isn't expressionable and there's no reason to think it can read Appian Expression code - the fact that it can swap in "ac!" values is the only exception to this and is, what I consider to be, a bare workaround. Still I would never, ever attempt what you're attempting in your screenshot in this node.

  • 0
    Certified Lead Developer
    in reply to Mike Schmitt

    The "Delete from DSE" setup is super simple, too.

    Side note: it's advised to only delete DB rows when you're *really really sure* you want them GONE.  Otherwise it's a strongly-suggested best practice to simply include a flag on the row along the lines of "is active" (which you'd set to "false") or "is deleted" (which you'd set to "true") and write the modified row back to the DB.  These flags would then be able to be reflected in default-condition queries in the future to avoid showing them on the front end, other than for admin / auditing reasons.

Reply
  • 0
    Certified Lead Developer
    in reply to Mike Schmitt

    The "Delete from DSE" setup is super simple, too.

    Side note: it's advised to only delete DB rows when you're *really really sure* you want them GONE.  Otherwise it's a strongly-suggested best practice to simply include a flag on the row along the lines of "is active" (which you'd set to "false") or "is deleted" (which you'd set to "true") and write the modified row back to the DB.  These flags would then be able to be reflected in default-condition queries in the future to avoid showing them on the front end, other than for admin / auditing reasons.

Children
No Data