TS does concatenation of any strings, variables and tags at any place where TML
is acceptable.
So you can select the value from the database and resave it right away with the
concatenation.
Let's say you so select just the column and record you want to edit:
SELECT column FROM table WHERE primary_key = 1
So resultset is now a 1x1 array of the value you want to append.
Then just update the record with the additional string:
UPDATE table SET column = '<@VAR resultset[1,1]> additional text' WHERE
primary_key = 1
I'm illustrating with SQL, but you would simply place:
<@VAR resultset[1,1]> additional text
In the value column of the update action.
As a more advanced way, you can have SQL do the concatenation in one query with
the + operator:
UPDATE table set column = column + 'additional text' WHERE primary_key = 1
The upside is that you only execute one query, the downside is that you don't
have the value afterwards.
You can do this with the update action but you must handle your own quoting. A
Custom SQL (directDBMS) would also work.
In 7.0.3 I added @APPEND (<@APPEND varname string>) so that you can write
clearer code when doing concatenation. Using the above resultset you would
<@APPEND resultset[1,1] 'additional text'> which, in my opinion, is obvious
code.
Robert
-----Original Message-----
From: Mark Weiss [mailto:[email protected]]
Sent: Thursday, March 05, 2015 6:33 PM
To: [email protected]
Subject: TeraScript-Talk: Concatenating Text
I can’t figure out how to select text from the db, assign it to a variable,
add text to that variable i.e. concatenate it, and then resave that new
variable back to the db so that it contains the original text and then the new
added text.
I am sure this is simple, but I can’t figure it out.
Help.
Mark
----------------------------------------
To unsubscribe from this list, please send an email to [email protected]
with "unsubscribe terascript-talk" in the body.
----------------------------------------
To unsubscribe from this list, please send an email to [email protected]
with "unsubscribe terascript-talk" in the body.