Hello, I have an array of a CDT and i would like to know how i can up

Hello,

I have an array of a CDT and i would like to know how i can update with a default value, using a rule, a specific field of that CDT only for specific indices of that array.

OriginalPostID-152653

OriginalPostID-152653

  Discussion posts and replies are publicly visible

  • I have also tried the following technique in SAIL interfaces, since our scenario calls for that functionality within a SAIL interface

    local!FieldArray = CDTArray.FieldToUpdate
    CDTArray.FieldToUpdate = updatearray(local!FieldArray, {indicesToUpdate}, valueToUpdate)

    Doing this i have seen that the updatearray function gives me the desired result, meaning that the specified indices have been updated with the value to update. However, the assignment back to CDTArray.FieldToUpdate is incorrect because the FieldToUpdate for all elements in the CDTArray variable ALWAYS has the value of the first element of the result of the updatearray function.
  • One method is to create a rule that uses type!CDT() and an index to set each field to either the indexed value or the default. Then you can apply the rule over the indexes of CDTArray.