HowTo append string to existing value when updating in process step

I have a process step using the HandleObject-Update component to update a bunch of datasets *1.  Using the val_ColumnName Jobparameter, I can set a fixed value, let's just say 

value = "New_Text"

How can I tell the process step to APPEND the fixed value to existing value, so that in the end the column-value of each dataset would be "Old_Text New_Text"

Edit: 

* that are linked to my BaseObject, but not the BaseObject itself

Parents
  • You can do it like this : 

    value = Base.getvalue("ColumnName").toString + "New Text"

    or via reference

    value = $ColumnName$.toString() + "New Text"

    best regards

  • Hi Michael,

    that would use the value of the $ColumnName$ of my BaseObject. But I want to update objects OTHER than my BaseObject.

    Example (Not my real use case, but to get the idea):

    Imagine you have a process on Person (Update). In this process, you have a step to update all PWO linked to this person. Each of the PWO has a diffrent value in OrderReason. 

    => Intended result: Each PWO linked to my Person Baseobject has value in OrderReason EXTEND by "Person disabled" (in addition to the OrderReason previously stated by the user)

    How can this be done using HandleObject-Update?

  • Hi matthias,

    yes you can also use HandleObject-Update to Update referenced Objects. In this case its a bit more Tricky.

    You can build it like this, with 2 Processes 

    Create a Process 1 on Person -> Event Person Update (GenCon inactive[o] = false and inactive = true)

    Create a ProcessStep -> Firegenevent -> ObjectType = "PersonWantsOrg" -> Event UPDATE_PWO_DISABLED

    WhereClause = "UID_PersonOrdered = " & $UID_Person$ &  " (this can be done better with formatter)

    Create a Process 2 on PersonWantsOrg -> Event UPDATE_PWO_DISABLED

    Create a ProcessStep -> Use Function "HandleObjectComponent - Update"

    Set following Parameter : 

    ObjectType -> "PersonWantsOrg"

    val_OrderReason -> Base.getvalue("OrderReason").toString + "New Text" 

    WhereClause = "UID_PersonWantsOrg = " & $UID_PersonWantsOrg$ &  " (this can be done better with formatter)

    Hope this helps.

    Best regards Michael

  • Hi Michael,

    using a second process was also on my mind, but seemed a bit like using a sledgehammer to crack a nut ;)

    The second process to update the linked objects would cause quite some overhead -image having have around 10k Persons with 10 linked objects each (once again, Person/PWO is just an example). That would result in 100k instances of the second process just to make an update on one single column.

    Taking into account that I do not really need the object-layer in my UseCase (the value in the updated column is just informative), I feel like rather using the SQL-Update (SQL-Component).

    Is there an official recommendation about creating such chain-reaction? I've already seen too many many custom implementations working fine in Dev-Environment with a couple of 100 datasets, but going nuclear in Prod when facing 100k ++.

  • I would use a script run by the script component for such task.. The one script can then run the updates for all the PWOs. This is what I would recommend.

  • Hi Markus,

    thanks for this hint. There seems to be no golden path for my UseCase anyway, but at first glance I like that approach the most (thinking of a script looping through an Entity Collection and updating the column).

    I hereby would like to place a feature request:

    The Job Component HandleObject.Update shall be able to reference the old value of the updated column and provide a syntax according the SQL-Statements

    1) Concat strings: Set Column1 = CONCAT(Column1, 'newstring') 
    2) Replace string: Column1 = REPLACE(Column1, 'oldstring', 'newstring')  -Bonus for RegEx-

    One could also think of integer (+,-), date (DateAdd) etc. pp.

Reply
  • Hi Markus,

    thanks for this hint. There seems to be no golden path for my UseCase anyway, but at first glance I like that approach the most (thinking of a script looping through an Entity Collection and updating the column).

    I hereby would like to place a feature request:

    The Job Component HandleObject.Update shall be able to reference the old value of the updated column and provide a syntax according the SQL-Statements

    1) Concat strings: Set Column1 = CONCAT(Column1, 'newstring') 
    2) Replace string: Column1 = REPLACE(Column1, 'oldstring', 'newstring')  -Bonus for RegEx-

    One could also think of integer (+,-), date (DateAdd) etc. pp.

Children
No Data