Hi Enrico (and anyone else listening),

    Basically I need to know if anything has changed in Class A,B,C,D or E
(with each being a parent of the previous) and if something has changed in a
parent I need to have ALL the children associated regardless if data has
changed on that child, as well as if nothing has changed on the parent but
just on the child, I need that child (which will ofcourse give me the parent
regardless).

    I did concider creating cursors for each and then walking down each with
a cursor, this would work but I would prefer to have a query I could call
instead.

Does that make sense!?!?!?

e.g.

^A(1)="AField1,AField2,AField3"
^B(1,1)="BField1,BField2,BField3"

In mumps its really easy!, But in SQL how do I implement this without
knowing the structure of the globals (i.e. just knowing the classes and
their properties)

K ARR
S A="" F  S A=$O(^A(A)) Q:A=""  S OK=$$CHECK(^A(1)) D
.S B="" F  S B=$O(^B(A,B)) Q:B=""  I OK!($$CHECK(^B(A,B))) D SAVEIT

CHECK()    ; Code not relevent, checks to see if data changed since previous
and returns 1 if has, 0 if hasn't
    Q OK

SAVEIT()    ; Again not relevent, but some routine that saves these nodes
    Q



"Enrico Parisi" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi Paul,
>
> sorry...but I still don't understand what you actually need to achive,
> the structure is now more clear while the goal, for me, is not!
>
> See comments inline
>
> Enrico
>
> Paul wrote:
>
> > I have 3 class each is a child of the previous, i.e.
> >
> > A has Children B
> > B has Children C
> >
> > I can't alter the class definitions as they are mapped to legacy
globals,
> > but I want to access them and produce information
> > based on whats in A, B and C.
> >
> > A, B and C hold data relevent to that level, and any of the data can be
> > changed without effecting data below.
>
> So far, so good.
>
> > Hence I have an query on A which tells me if anything has changed and
> > populate an array with the ID's
>
> Here I start getting confused, what is your goal? It looks you need to
> find out what "has changed", how do you check that? The array looks like
> an attempt to resolve the problem...but first, let's understand the
> problem :)
> >
> > I then want to query B and see if anything has changed AND also return
> > anything which has changed on A (i.e. within the array of ID's).
> >
> > And then so forth for C (and infact D and E).
> >
> > I thought I could do the whole select with a select (x5), but the SQL
got
> > massive and also didn't work hence I was splitting the process down to
do a
> > query on each class.
> >
> >
> >     Hope that makes sense!, ANY help much appreciated.
> >
> >
> > "Enrico Parisi" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> >>Hi Paul,
> >>
> >>I don't fully understand your question, what do you mean with "if its
> >>parent is in the array of objects" ?
> >>
> >>I cannot be precise but I think you can get advantage of Cach� implici
> >>joins like "Parent->ID" to get the ID of a referenced table.
> >>
> >>Maybe something like this?
> >>
> >>Select <whatever>
> >>from tab3
> >>where tab2->tab1->ID = ParentID
> >>
> >>In this case tab1 is parent, tab2 is child, tab3 is the SQL projected
> >
> > array.
> >
> >>If you post a sample tables structire it would be easier to help you.
> >>
> >>Ciao
> >>
> >>Enrico
> >>
> >>Paul wrote:
> >>
> >>>Hello All,
> >>>    Not being a SQL whiz I've got a "surely" simple problem, can
someone
> >>>help?
> >>>
> >>>
> >>>    I have an array of objects and wish to select on a child table if
> >
> > its
> >
> >>>parent is in the array of objects, how do I write this in SQL?
> >>>
> >>>I want in logic terms this...
> >>>
> >>>SELECT * FROM Table WHERE Field1=:VAR1 OR $D(:ARRAY(Parent->ID))
> >>>
> >>>But ofcourse $D isn't an SQL function! I can't figure how to do it in
> >
> > SQL..
> >
> >>>
> >>>Any help much appreciated.
> >>>
> >>>
> >>>Thankyou
> >>>
> >>>
> >>
> >
> >
>



Reply via email to