Related to function..

Certified Senior Developer

I am just looking at this rule and find this unsupported function can anyone tell me that what is the behaviour of this function .

reduce(
update_unsupported(_,_,_),
{},
{}
)

what we can use instead of update_unsupported to remove (_,_,_)

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    We'd need more context - where was this found and what does it seem to be doing?  I haven't seen it myself, but there's a chance it could be a reference to a pre-publication version of something like a!update(), which was only released relatively recently (in the long run).  But without more context it's hard to say.

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    I am trying to replace this function , Currently i am reducing and merging the dictionary data, so i just want to know what i can do better

    reduce(
    update_unsupported(_,_,_),
    cast(
    'type!{urn:com:appian:types}TSW_Resident',
    rule!TSW_getResidentByYardiID("t0020328")
    ),
    merge(
    {
    "ResidentYardiID",
    "PropertyYardiID",
    "Email",
    "FirstName",
    "HomeNumber",
    "LastName",
    "LeaseEndDate",
    "LeaseStartDate",
    "MobileNumber",
    "OfficeNumber",
    "Status",
    "ReasonForMoveOut",
    "MoveInDate",
    "MoveOutDate",
    "CreateDate",
    "CreateUser",
    "UpdateDate",
    "UpdateUser",
    },
    {
    "dd",
    "dd",
    "dd",
    "dd",
    "dd",
    "ss",
    "aa",
    "fff",
    "ff",
    "ff",
    "ff",
    "ff",
    "sss",
    "ff",
    now(),
    null,
    now(),
    null
    }
    ),
    )

  • 0
    Certified Lead Developer
    in reply to Ankush Sharma

    BTW:

    It seems at first glance whether this is doing similar to a!update or updateDictionary() and updating the fields named in the first array with the values in the final array.  I'm unclear why it's using reduce() unless that's somehow doing something more convoluted with the results of the query rule i.e. if it returns a list rather than a single value; i suppose maybe it's stepping through the list of keys one at a time and replacing the values one at a time, which of course with the modern a!update() function should be totally unnecessary as it handles a list of replacement property names followed by a list of replacement values, and handles all of that inherently.

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    yeah you are right i have replaced the fucntion with update 

    we are currently updating one at a time 



    I don't know it is right or not

  • 0
    Certified Lead Developer
    in reply to Ankush Sharma

    Well with a!update() it should be as simple as just calling it once:

    a!update(
      value: rule!TSW_.......(""),
      index: {
        "ResidentYardiID",
        "PropertyYardiID",
        "Email",
        "FirstName",
        "HomeNumber",
        "LastName",
        "LeaseEndDate",
        "LeaseStartDate",
        "MobileNumber",
        "OfficeNumber",
        "Status",
        "ReasonForMoveOut",
        "MoveInDate",
        "MoveOutDate",
        "CreateDate",
        "CreateUser",
        "UpdateDate",
        "UpdateUser",
      },
      value: {
        "dd",
        "dd",
        "dd",
        "dd",
        "dd",
        "ss",
        "aa",
        "fff",
        "ff",
        "ff",
        "ff",
        "ff",
        "sss",
        "ff",
        now(),
        null,
        now(),
        null
      }
    )

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    I think that by using the reduce function along with the update_unsupported function, we are merging the data and saving it to the fields one by one. Correct me if I'm wrong.

  • 0
    Certified Lead Developer
    in reply to Ankush Sharma

    if it's old enough, there's a chance that was the only way.  My point is, that one-by-one update is no longer necessary and probably isn't useful for anything.  Other than making the code unreasonably confusing.

Reply Children
No Data