I fixed this to use lists... Maybe. put parentArray( LISTNEW ) into aNew put parentArray( LISTOLD ) into aOld intersect aNew with aOld -- Remove from aOld that which is not in aNew union aOld with aNew recursively -- Leaves aNew unchanged except that children in aOld are brought in. I think. put parentList( aNew ) into LISTNEW
Parents and children are keys in the arrays built. Children are sub-arrays of parents. > On Aug 5, 2019, at 12:31 PM, Dar Scott Consulting via use-livecode > <use-livecode@lists.runrev.com> wrote: > > I'm pretty sure I goofed somewhere, but maybe something like this? > > intersect ARRAYNEW with ARRAYOLD into temp > union temp with ARRAYNEW recursively > > >> On Aug 5, 2019, at 9:53 AM, Paul Dupuis via use-livecode >> <use-livecode@lists.runrev.com> wrote: >> >> Today is not my coding day. I have a problem I should be able to design a >> solution for an am struggling. Clearly I am missing "something" >> >> I have 2 lists (LISTNEW and LISTOLD) of the following format: >> >> ParentA >> <space>Child 1 >> <space>Child 2 >> <space>etc. >> ParentB >> <space>Child 1 >> <space>etc. >> etc. >> >> The parents are in alphabetical sorted order, the children may not be in >> sorted order >> >> I need to hunt through LISTOLD comparing the LISTOLD Parents to the LISTNEW >> Parents >> FOR any LISTOLD Parent present in LISTNEW, check the Children of the >> matching Parents and add any Child for the LISTOLD Parent that is not >> already under its matching LISTNEW Parent >> FOR any LISTOLD Parent NOT in LISTNEW, I can ignore the Parent and its >> Children >> >> I can not seem to write an approach to solve this today. Does any body have >> some code so solve this they may be willing to share? >> >> _______________________________________________ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode >> > > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode