I can make an action to overwrite data for a field, but am struggling to work out how to append data to an existing field (without overwriting).
To overwrite I use the "Data - set a data value" option. I have read in another thread that to add without overwriting I can use the "Data - add an item to a list" option. But this doesn't seem to be permitted with the datatype of my field (longtext).
Should I change the datatype of the field (and if so what to)?
Or maybe I should stick with the original "set a data value" option and use some PHP to append the new value rather than overwrite (if so how)?
Or maybe there is another way.
I guess for someone this is pretty elementary but I am on the limits of my ability here so any guidance would be much appreciated.
Thanks.
Comments
Comment #1
mitchell CreditAttribution: mitchell commentedThis isn't currently possible using the data selector, but it is possible to use tokens for this. All you need is a space, so something like: "[current:field:text] [other-entity:field:text]".
Comment #2
mitchell CreditAttribution: mitchell commentedComment #3
mitchell CreditAttribution: mitchell commentedComment #4
jonodunnett CreditAttribution: jonodunnett commentedOK thanks Mitchell, but I am still struggling a bit... What I am trying to do is allow users to enter some text which will then get added to the existing "history" field of the selected nodes (the action will be called as a bulk operation).
In the settings I have entries for
Data type Label Machine name Usage
Node Windsurf sail windsurf_sail Parameter
Text History entry history_entry Parameter
In the conditions I check for the existence of the field (wssailhistory) that I wish to update.
I create an action: "data - set a data value" to update the history field with the user entered value. In direct input mode I enter the value:
[windsurf-sail:field-wssailhistory] [history-entry]
But the updated field comes out as the original field with "[history-entry]" appended*, rather than having the actual text that users are prompted to enter appended. How do I get text entered by the users appended to the existing field?
I have also tried the "data - calculate a value" option but cannot get this to work either, and am unclear as to whether this is the action I should be using, or perhaps I need to use a combination of actions.
I can sense it should be easy. But can't figure out what I need to do.
* also tried [history_entry] but same result (not retrieving user-entered value).
Update:
I was being Dim. All I needed to do was (using the "data- calculate a value" action):
[windsurf-sail:field-wssailhistory]
print $history_entry
Comment #5
jonodunnett CreditAttribution: jonodunnett commentedComment #6
mitchell CreditAttribution: mitchell commentedUpdated component.