---Dan Bron wrote:
> I'm going to try to rephrase your question. Let me know if
> I've got it right.
>
> Assuming the above, then does the following suit?
>
> join =: dyad define
> indices =. ({."1 y) i. x
> values =. indices { ({:"1 y) , <,'0'
> x ,. values
> )
>
> tblall join tbl1,tbl2 NB. Append input tables as required
>
...
> Also, you merge multiple tables in multiple steps, whereas
> the above code
> treats the aggregation of all ID,Value tables as a single input (the
> tables agree in type and shape, and that fact can be
> leveraged). "Doing it all at once" is a common pattern in J.
My understanding of Harvey's description is that he expects the tblall array to
grow by one column for each set of data added.
If my understanding is correct then I think a slight alteration to Dan's answer
will do what Harvey wants.
join =: dyad define
indices =. ({."1 y) i. {."1 x
values =. indices { ({:"1 y) , <,'0'
x ,. values
)
(tblall join tbl1) join tbl2
+---------+----------+----------+
|b18934225|08-28-2008|12-17-2008|
+---------+----------+----------+
|b18934286|08-28-2008|0 |
+---------+----------+----------+
|b18934304|0 |10-21-2008|
+---------+----------+----------+
|b18934468|09-01-2008|0 |
+---------+----------+----------+
|b18935618|0 |0 |
+---------+----------+----------+
|b1893741x|10-14-2008|11-25-2008|
+---------+----------+----------+
Here is an alternative join using expand with a custom fill.
join2 =: dyad define
msk =. x e.&:({."1) y
values =. msk #^:_1!.(<'0') {:"1 y
x ,. values
)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm