Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6548289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:56:01+00:00 2026-05-25T11:56:01+00:00

I have this list: ADD X ADD Y REMOVE Z ADD X NO ACTION

  • 0

I have this list:

  • ADD X
  • ADD Y
  • REMOVE Z
  • ADD X
  • NO ACTION Y

I need of this results:

  • ADD X
  • NO ACTION Y
  • REMOVE Z

The rules to calculate the delta are these:
I have 3 action (ADD, REMOVE, NO ACTION)

  1. ANY ACTION * NO ACTION = NO ACTION
  2. ADD * REMOVE or REMOVE * ADD = NO ACTION
  3. SAME ACTION * SAME ACTION = SAME ACTION

The problem is that I implement this with a functional language (XQuery). I found a logic, based on fn:distinct-values. But the last rule (3) is unsatisfied.

Thanks in advance!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:56:01+00:00Added an answer on May 25, 2026 at 11:56 am

    Finally I found the way. I hope that this is good.

    These are my first experiments with XQuery and I need to remeber what I have under my fingers and what possibilities this language offer.

    My problem is data that came in. And I decide to transformate the information in a structure that can I easily manipulate.

    A golden brick to solve this is this example about grouping data :

    for $d in distinct-values(doc("order.xml")//item/@dept)
    let $items := doc("order.xml")//item[@dept = $d]
    order by $d
    return <department code="{$d}">{
         for $i in $items
         order by $i/@num
         return $i
       }</department>
    

    After this I used this algorithm:
    0. If the count of action == 1 -> take first action
    1. else If exist almost ONE – NO ACTION -> NO ACTION (RULE 1)
    2. else If exist ADD and REMOVE in same list -> NO ACTION (RULE 2)
    3. else take the first action (equal actions)

    For this I borrowed a function from functx library:

    declare function local:is-value-in-sequence( $value as xs:anyAtomicType? ,$seq as      xs:anyAtomicType* )  as xs:boolean {
     $value = $seq
     };
    

    Simple but effective.

    Thanks a lot for all!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My Action class have the following methods, 1.add 2.edit 3.loadEdit 4.remove 5.list 6.execute in
i have this code: var list = new List<int>(); for(int i=0;i<10;i++) list.Add(i); for(int i=0;i<10;i++)
I have written a function for deleting object preiodically. function add(variable, expireSecond){ this.list[variable] =
I have the following code: SPList list = web.Lists[this.ListName]; SPListItem item = list.Items.Add(); now
I have a list like this Dim emailList as new List(Of String) emailList.Add(one@domain.com) emailList.Add(two@domain.com)
I have a link in a page that goes like this: Url.Action(List, Item, new
Hello I have this list that i am working on. When i move the
Actually I have this list Directory where I am adding the name of the
So i have this ArrayList: list.get(0) == love list.get(1) == foo list.get(2) == make
I have this drop-down list of countries: <select name=country> <option value=>Country...</option> <option value=Afganistan>Afghanistan</option> <option

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.