PDA

View Full Version : Evaluating Ext JS 4.1 and looking for features (JSON Joins)



JRoysdon
6 Nov 2013, 9:41 AM
In researching some methods for use in XPages, I came across a series of articles (http://xomino.com/category/extjs-in-xpages/) by Mark Roden on datagrids utilizing the Sencha EXT JS. Well written and halfway through the series, the author talks about the merits of 4.2 vs 4.1 and utilizing a buffered renderer. I liked it, however I am also looking for something more robust.

It got me to thinking (:-?) about some requirements for an upcoming project, and that would be taking two unstructured data sources (in the form of a table or view represented as JSON objects) and merging them into a third via a JOIN method (left, right, inner, outer, etc). I've gone around with the idea for a while, but the overhead of doing such a query and processing on either the server or the client side when large queries (500 plus results in each JSON object) are involved could be immense, especially on a popular website. However, I was thinking that if the model utilized for "buffered rendering" could be re-used or expanded to process the joins on a more focused, smaller result set, could the overhead be reduced? Let me give you a small example of what I am looking at.

For JOIN examples, Coding horror has an article (http://www.codinghorror.com/blog/2007/10/a-visual-explanation-of-sql-joins.html)that graphically depicts how joins work. Using that data, let's make two JSON objects from tables:



Table One
(Xpages DB )
Table Two
(SQL DB )


id
name
id
name


1
Pirate
1
Rutabaga


2
Monkey
2
Pirate


3
Ninja
3
Darth Vader


4
Spaghetti
4
Ninja






Table One

[
{
"id": 1,
"name": "Pirate"
},
{
"id": 2,
"name": "Monkey"
},
{
"id": 3,
"name": "Ninja"
},
{
"id": 4,
"name": "Spaghetti"
}
]

Table Two

[
{
"id": 1,
"name": "Rutabaga"
},
{
"id": 2,
"name": "Pirate"
},
{
"id": 3,
"name": "Darth Vader"
},
{
"id": 4,
"name": "Ninja"
}
]

For a LEFT JOIN on two tables like this, it would take 4 iterations (4 rows in Table One) and the result set would look like:

Table Three
[ {
"id_ONE": 1,
"name_ONE": "Pirate",
"id_TWO": 2,
"name_TWO": "Pirate"
},
{
"id_ONE": 3,
"name_ONE": "Ninja",
"id_TWO": 4,
"name_TWO": "Ninja"
}
]

Small tables are easy, but what about large tables? Is there anything in Sencha that could do something like this? With Xpages, our data sources can be within the unstructured database, or outside via a JDBC call to another database on a different server (which adds more complexity). Also, what if the first table is 1000 records/rows and 5 people hit it at the same time? That has the potential of 5000 interations, if the results are not cached somewhere.

Anyway, that is what I am looking for. Is there something in Sencha that does this? What are your experiences and what are the risks?

Thanks,

Jim

scottmartin
8 Nov 2013, 6:12 AM
I would definitely perform any data merging at the server level with SQL. (union, groupby, etc)

I am sure you would work up something at the client level, but why not let the server DB do it's job.

Scott.

JRoysdon
8 Nov 2013, 6:47 AM
The issue is not that in our case the database is NOT a SQL database and uses unstructured data. The data can be viewed in tables/grids IF they are from the same form/document. This database structure has been around for years in Lotus Notes and is now found in MongoDB. In both cases, tables of data can be presented in JSON objects, but not from different forms (tables). There is just no JOIN.