a!save Function for multiple values

Hi All,

I am having the following code, i have a ID called abc.id and it contains, values as 001,002 and now,

there is another CDT called def where i need to save the values of def.abcid as 001 and 002,

when i am trying to do it like this,,

 

a!save(ri!def.abcid,ri!abc.id) when i do this, i am only getting it as 001. for the 2 values which i have that is,

{

def.id:001

def.name:Abc

def.abcid:001

def.lastupdatedby:now()

def.lastupdateddate:loggedInUser()

},

{

def.id:001

def.name:Abc

def.abcid:001

def.lastupdatedby:now()

def.lastupdateddate:loggedInUser()

}

Ideally i need the second set updated with def.abcid:002

How can i do this on a!save()

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    Hi harshav,

    Try creating a separate rule to save the values and call that rule in the submit button saveInto,

    Sample is here,
    Separate rule name: testingSave
    {
    a!save(
    ri!def[ri!index].abcid, /* ri!index - Number(Integer) - Single , ri!number - Number(Integer) - Single and ri!def - CDT type - Array */
    ri!number
    ),
    a!save(
    ri!def.lastupdatedby,
    loggedInUser()
    ),
    a!save(
    ri!def.lastupdateddate,
    now()
    ),
    a!save(
    ri!def.name,
    "Abc"
    )
    }

    In Submit button saveInto:
    apply(
    rule!testingSave(
    def:ri!def,
    index:_,
    number:_
    ),
    {
    merge(
    {
    enumerate(
    length(
    ri!numbers
    )
    ) + 1},
    {
    index(ri!abc,"id",{})
    }
    )
    }
    )
Reply
  • 0
    Certified Lead Developer
    Hi harshav,

    Try creating a separate rule to save the values and call that rule in the submit button saveInto,

    Sample is here,
    Separate rule name: testingSave
    {
    a!save(
    ri!def[ri!index].abcid, /* ri!index - Number(Integer) - Single , ri!number - Number(Integer) - Single and ri!def - CDT type - Array */
    ri!number
    ),
    a!save(
    ri!def.lastupdatedby,
    loggedInUser()
    ),
    a!save(
    ri!def.lastupdateddate,
    now()
    ),
    a!save(
    ri!def.name,
    "Abc"
    )
    }

    In Submit button saveInto:
    apply(
    rule!testingSave(
    def:ri!def,
    index:_,
    number:_
    ),
    {
    merge(
    {
    enumerate(
    length(
    ri!numbers
    )
    ) + 1},
    {
    index(ri!abc,"id",{})
    }
    )
    }
    )
Children