Is there a way to concatenate string via UpdateExpressions? Let me explain better, for example, if a record has an id, thread and message, and for some reason, I intend to update one attribute with an information that already exists in the record, I could perform an expression like:
updateExpression = `SET #thread2 = #thread
it works, but unfortunately I couldn't do something beyond this, like a concatenation:
updateExpression = `SET #department = #thread + #id
or
updateExpression = `SET #department = #thread.#id
or
updateExpression = `SET #department = #thread#id
Some ideas? If not, I guess it could be very useful to avoid a GET before an UPDATE operation just to get an existent data and concatenate with some other stuff.
Unfortunately, there is no option to concatenate the String data directly in UpdateExpression
(i.e. using +
or any other operator or function).
The operator +
can be used for Number data type to increment the value. However, it doesn't work for String data type.
As you mentioned, the only way to achieve this is get the item, concatenate the value and update the item.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With