update

i'll get list of data from one query, to that query data i have to map few fields value 

ex query1 gives :

id :54,  class: B, owner :xyz

id:54, class: A, owner :test

from second query from another table will get 

id:54, owner :abc

this second query owner data needs to update/show in query1 how can i achieve this 

update for

id:54, class:A , owner: abc

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    Hi  ,

    You can try this

    a!localVariables(
      local!query1:{
        a!map(
          id:52,
          class:"A",
          owner:"xyz"
        ),
        a!map(
          id:54,
          class:"AB",
          owner:"asdf"
        )
      },
      local!query2:{
        a!map(
          id:54,
          owner:"abc123"
        )
      },
      local!query2index:wherecontains(
        tointeger(index(local!query2,"id",null)),
        tointeger(index(local!query1,"id",null))
      ),
      a!update(
        local!query1[local!query2index],
        "owner",
        local!query2.owner
      )
    )

Reply
  • 0
    Certified Associate Developer

    Hi  ,

    You can try this

    a!localVariables(
      local!query1:{
        a!map(
          id:52,
          class:"A",
          owner:"xyz"
        ),
        a!map(
          id:54,
          class:"AB",
          owner:"asdf"
        )
      },
      local!query2:{
        a!map(
          id:54,
          owner:"abc123"
        )
      },
      local!query2index:wherecontains(
        tointeger(index(local!query2,"id",null)),
        tointeger(index(local!query1,"id",null))
      ),
      a!update(
        local!query1[local!query2index],
        "owner",
        local!query2.owner
      )
    )

Children
No Data