Hi,

  I have a data structure (that works well so far) with three similar
  sub-views that are accessed, set, and summarized at different
  points.  Now I have a requirement to output a summary of all the
  detail with a label that identifies with of the three sets the data
  came from.  The solution I came up with doesn't work, so I am
  thinking out loud to see if someone has an idea that involves the
  least amount of re-coding.  The sub-views are accessed quite a bit
  in normal processing, and the summary only needs to be created once
  or twice a month.

  Simplized data format:
>>> vw =
  
db.getas('main[id:I,fname:S,lname:S,new[key:S,val:I],old[key:S,val:I],adj[key:S,val:I]')
>>> jdb.dump(vw)
 id    fname   lname  new     old     adjs
 ----  ------  -----  ------  ------  ------
    1  first1  last1  0 rows  0 rows  0 rows
    2  bob     last2  2 rows  0 rows  0 rows
    4  first4  last4  2 rows  0 rows  4 rows
  
  Using a combination of flatten, union, and project I can get REAL
  CLOSE to what I want:

>>> jdb.dump(vw31)
 id    key    val
 ----  -----  ---
    2  val10   10
    2  val20   20
    4  val10   10
    4  val10   10
    4  val20   20
    4  val20   20
    4  val30   30
    4  val40   40

 What I need is to know WHICH type of value each row is:
 id    key    val  type
 ----  -----  ---  ----
    2  val10   10  new
    2  val20   20  new
    4  val10   10  new
    4  val10   10  adj
    4  val20   20  new
    4  val20   20  adj
    4  val30   30  adj
    4  val40   40  adj

 The main problem being that one cannot successfully add a property to a
 PyROViewer object, which is the result of the union and flatten
 methods.  It seems I either have to:

 1) create a separate temporary view for each type and manually copy
    the flattened view into it, creating and setting 'type'
    appropriately.  Then union off of these PyView objects.
 2) or modify my system to always write the subview type into the
    subview.  This means extra programming and run-time overhead, and
    extra strings in tens of thousands of records.
 3) or some other creative idea you suggest.
 
-- 
Thanks,

Jerry McRae
MetaKit 2.4.9.2, Python 2.3.2, WinXP, 796M RAM
___________________________
Conform and be dull --J. Frank Dobie

_____________________________________________
Metakit mailing list  -  [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit

Reply via email to