cdt n for each loop issue

Hi,

 I am having a cdt structure like cdt A(id,yes,no) which i m using to add data using Add icon similar to grid add .Once when i enter the id it will display another section with cdt B structure(a,b,c,d) where a,b will be populated based upon the id automatically.For c and d we have to enter manually. once entered it will save into cdt structure B.

I m using for each loop with item as cdt A structure and passing CDT B as paramter.

the issue i m facing is when i m trying to add values to cdt b(2nd time by clicking add icon) ,it is updating the value to cdt b and cdt a instead of appending it.

Kindly provide any suggestions on how to save the value inside add save function,also how to pass the index of cdt B as parameter.

Sample code:

a!foreach(

items:local!cdt A(structure of cdt a)

expression: rule (cdt b)

a!imageField(
images: a!documentImage(
document: a!iconIndicator(icon: "ADD"),
link: a!dynamicLink(
value: 'type!cdta(),
saveInto: {a!save(local!cdt A, append(local!cdt A, save!value)),
a!save(ri!cdta,local!cdt A)
}
)
)

)

 

 

Thanks in Advance

PradeepB

 

  Discussion posts and replies are publicly visible

Parents
  • I have a suggestion, Why don't you try to use a field that is in your cdtA so something like this {id: null} so it would create a new insert in your CDT A with everything set as null.  I believe this will help you append to your CDTA.

    Let me know if this helps.

     

    load(
      local!cdtA: {
        {
          id: 1,
          name: "Test"
        },
        {
          id: 2,
          name: "Test2"
        }
      },
      a!linkField(
        label: "",
        labelPosition: "ABOVE",
        links: {
          a!dynamicLink(
            label: "Test",
            value: {
              id: null
            },
            saveInto: saveInto: {
              a!save(
                local!cdtA,
                append(
                  local!cdtA,
                  save!value
                )
              ),
              a!save(
                ri!cdta,
                local!cdtA
              )
            }
          ),
          
        }
      )
    )

Reply
  • I have a suggestion, Why don't you try to use a field that is in your cdtA so something like this {id: null} so it would create a new insert in your CDT A with everything set as null.  I believe this will help you append to your CDTA.

    Let me know if this helps.

     

    load(
      local!cdtA: {
        {
          id: 1,
          name: "Test"
        },
        {
          id: 2,
          name: "Test2"
        }
      },
      a!linkField(
        label: "",
        labelPosition: "ABOVE",
        links: {
          a!dynamicLink(
            label: "Test",
            value: {
              id: null
            },
            saveInto: saveInto: {
              a!save(
                local!cdtA,
                append(
                  local!cdtA,
                  save!value
                )
              ),
              a!save(
                ri!cdta,
                local!cdtA
              )
            }
          ),
          
        }
      )
    )

Children