Loop "Write to Data Store Entity" process activity

I have a process variable that is a list of CDT records. I want to iterate over this list and write a DSE in a separate table for each process variable row, using values from the row.

Does the Repeat option in the Write to Data Store activity accomplish this? I can configure it to repeat for the length of the process variable, but not sure how it would index each to reference.

I also tried a script task with a for loop that call the write to data store function. It didn't save anything to the table. I googled later and say that the function doesn't work in process models

Does anyone have an approach to this?

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Sorry for the confusion. A better example below:

    We read new records from a table (Table A) every morning. Let's say there are 5 new records and that array is sent to a process model. The CDT can be {A, B, C}

    For each record in that array, we want to make to make an entry into another CDT table (Table B) using the record's values.

    Input

    From Table A: {A, B, C} x 5

    Output

    Inserted to Table: B: {A, C, D, E} x5

  • +1
    Certified Lead Developer
    in reply to seze

    Ok, so assuming that there is only one destination table, there should be no need at all to "loop" your write to data store -- you would just have the WTDS node write the whole array of your current CDT.

    It sounds like you're also trying to transform the original data {A, B, C} into something new {A, C, D, E} -- this you would simply handle separately, prior to the WTDS node, let's say in a script task where you read the original values from one PV and output your desired results into a separate PV (which you would then reference in the subsequent WTDS node).