Modify Multi Value CDT

I've defined a CDT as a Multi Value. At run time I will have 'n' instances of the object.
During runtime I wish to update a specific field for one of the instances of the object but I'm not seeing how to address the field correctly.

I cant use array[1].field as that's only addressing the first instance. So for example I have at run time the multi Value CDT with the values :

                     Instance1 Instance2 Instance3

Field1(Text)       A                 D              G

Field2(Text)       B                   E             H

Field3(Boolean)  true             false       false

I want to change Instance3 Field 3 from false to true. How to address it because when we modify the value of CDT, it is just updating in the first instance and I am not able to pass the count of the instance

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Please post a screenshot and/or code for what you're currently trying in your process model - I can't tell based on just the detail you've provided here.

  • I am modifying the highlited variable, but email Details have 3 instances and it is modifying it in the first instance. How do i get it to modify it in the second instance, For ex i want to add/modify in emailDetails[2].hasAutoHeaders.

  • 0
    Certified Lead Developer
    in reply to parula0001
    1. The "emailDetails" input isn't configured as an array - why?
    2. Why are you doing this in the Inputs tab?  It's usually easier to do data manipulations in the Outputs tab.
  • emailDetails is a Multiple value variable. I am not getting the option to add in the second instance in output tab too. 

    Can i use stored at index of in output tab, if yes can you help me with how?

    Thanks.

  • You can make it emailDetails as Array for that just click on the multple check box and in the output tab stored values just pass data back to PV (emailDetials).and also As i understood that you want manipulate multiple instances so for that you can use updateDictionary in the script task  after data back to PV if im not wrong .

    if im wrong please elaborate your actual scenario with screenshots 

    Thanks 

  • Hi , emailDetails is a CDT  

    I want to enter headersPresent variable in the instance of emailDetails, when i am trying to do that by the following expression rule it's adding the headersPresent in the first instance of emailDetails.

    For example: As the emailDetails is multi-valued it is coming as -

     [fromId=parul@abc, fromName=, toIds=, ccIds=, bccIds=, subject=, attachments=, body=, latestBody=, hasattachments=, emailid=, hasAutoHeaders=true],[fromId=xyz@comp, fromName=, toIds=, ccIds=, bccIds=, subject=, attachments=, body=, latestBody=, hasattachments=, emailid=, hasAutoHeaders=false]

    It is changing the hasAutoHeaders to true in the first instance as you can see when it should change the hasAutoHeaders to true in the second instance. 

    Please read the above main explanation.

    "

    I cant use array[1].field as that's only addressing the first instance. So for example I have at run time the multi Value CDT with the values :

                         Instance1 Instance2 Instance3

    Field1(Text)       A                 D              G

    Field2(Text)       B                   E             H

    Field3(Boolean)  true             false       false

    I want to change Instance3 Field 3 from false to true

    "

    Hope its clear now. Thanks

  • You try below code .You need to use in updatedictionary in script task

    a!localVariables(
    local!a: {
    {fromId:"parul@abc", fromName:"test", toIds:1, ccIds:23, bccIds:2, subject:"sd", attachments:1, body:12, latestBody:12, hasattachments:12, emailid:2, hasAutoHeaders:true},
    {fromId:"xyz@comp", fromName:"test", toIds:1, ccIds:2, bccIds:3, subject:"sd", attachments:2, body:1, latestBody:1, hasattachments:21, emailid:12, hasAutoHeaders:false}

    },
    local!b:true,
    a!forEach(
    items: local!a,
    expression: updatedictionary(
    fv!item,
    {hasAutoHeaders: local!b}
    )
    )
    )

Reply
  • You try below code .You need to use in updatedictionary in script task

    a!localVariables(
    local!a: {
    {fromId:"parul@abc", fromName:"test", toIds:1, ccIds:23, bccIds:2, subject:"sd", attachments:1, body:12, latestBody:12, hasattachments:12, emailid:2, hasAutoHeaders:true},
    {fromId:"xyz@comp", fromName:"test", toIds:1, ccIds:2, bccIds:3, subject:"sd", attachments:2, body:1, latestBody:1, hasattachments:21, emailid:12, hasAutoHeaders:false}

    },
    local!b:true,
    a!forEach(
    items: local!a,
    expression: updatedictionary(
    fv!item,
    {hasAutoHeaders: local!b}
    )
    )
    )

Children
No Data