PDA

View Full Version : Javascript improvement



Matt Casters
08-22-2007, 04:50 PM
Hi Kettle devs,

It has come to my attention that the current implementations of Javascript
(all versions) have problems with field names that contain spaces, dashes and
other special characters. For obvious reasons these fields are not useable
in JavaScript.

I would propose to expose these fieldnames using underscores to replace these
unwanted characters.

Any objections?

All the best,

--
Matt
____________________________________________
Matt Casters, Chief Data Integration
Pentaho, Open Source Business Intelligence
http://www.pentaho.org -- mcasters (AT) pentaho (DOT) org
Tel. +32 (0) 486 97 29 37

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "kettle-developers" group.
To post to this group, send email to kettle-developers (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to kettle-developers-unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/kettle-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Roland Bouman
08-22-2007, 05:50 PM
Hi Matt,

> I would propose to expose these fieldnames using underscores to replace these
> unwanted characters.

That could clash with other field names. I would probably avoid having
those kinds of names anyway, but there may be a solution that
preserves all names regardless. That is, I don't know if it is
feasible or easy to implement, but I know that this type of syntax is
valid:

var inputs = {};
o["name with spaces"] = 1;
o["name-with-dahses"] = 2;

or, more compact:

var inputs = {
"name with spaces": 1
, "name-with-dashes": 2
}

So afterwards, you can refer to them as: inputs["name with spaces"]

just an Idea - not a big deal for me if it would be replaced with underscores ;)

>
> Any objections?
>
> All the best,
>
> --
> Matt
> ____________________________________________
> Matt Casters, Chief Data Integration
> Pentaho, Open Source Business Intelligence
> http://www.pentaho.org -- mcasters (AT) pentaho (DOT) org
> Tel. +32 (0) 486 97 29 37
>
> >
>


--
Roland Bouman
http://rpbouman.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "kettle-developers" group.
To post to this group, send email to kettle-developers (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to kettle-developers-unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/kettle-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Matt Casters
08-22-2007, 06:00 PM
Hi Roland,

You would have to populate these "Hash" tables for every row and as such I
worry about the performance.

FYI, the fields are now accessible through the compatible option:

row.getString("name-with-spaces", "");

Since we're doing the replacement only once for all rows that pass we can make
the algorithm as complex as possible. As such we can give existing names
precedence. I mean, what are the odds that such a condition pops up? :-)

Thanks for your input, I'll stay away from it for the time being.

All the best,

Matt


On Wednesday 22 August 2007 22:41:31 Roland Bouman wrote:
> Hi Matt,
>
> > I would propose to expose these fieldnames using underscores to replace
> > these unwanted characters.
>
> That could clash with other field names. I would probably avoid having
> those kinds of names anyway, but there may be a solution that
> preserves all names regardless. That is, I don't know if it is
> feasible or easy to implement, but I know that this type of syntax is
> valid:
>
> var inputs = {};
> o["name with spaces"] = 1;
> o["name-with-dahses"] = 2;
>
> or, more compact:
>
> var inputs = {
> "name with spaces": 1
> , "name-with-dashes": 2
> }
>
> So afterwards, you can refer to them as: inputs["name with spaces"]
>
> just an Idea - not a big deal for me if it would be replaced with
> underscores ;)
>
> > Any objections?
> >
> > All the best,
> >
> > --
> > Matt
> > ____________________________________________
> > Matt Casters, Chief Data Integration
> > Pentaho, Open Source Business Intelligence
> > http://www.pentaho.org -- mcasters (AT) pentaho (DOT) org
> > Tel. +32 (0) 486 97 29 37



--
Matt
____________________________________________
Matt Casters, Chief Data Integration
Pentaho, Open Source Business Intelligence
http://www.pentaho.org -- mcasters (AT) pentaho (DOT) org
Tel. +32 (0) 486 97 29 37

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "kettle-developers" group.
To post to this group, send email to kettle-developers (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to kettle-developers-unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/kettle-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Roland Bouman
08-22-2007, 06:40 PM
Hi Matt,

> You would have to populate these "Hash" tables for every row and as such I
> worry about the performance.

True. I agree - performance is more important.
>
> FYI, the fields are now accessible through the compatible option:
>
> row.getString("name-with-spaces", "");

Ok - well, that settles it for me ;)

>
> Since we're doing the replacement only once for all rows that pass we can make
> the algorithm as complex as possible. As such we can give existing names
> precedence. I mean, what are the odds that such a condition pops up? :-)

Indeed. Like I said, I would stay far away from strange names like that.
>
> Thanks for your input, I'll stay away from it for the time being.

np - kind regards,

Roland
>
> All the best,
>
> Matt
>
>
> On Wednesday 22 August 2007 22:41:31 Roland Bouman wrote:
> > Hi Matt,
> >
> > > I would propose to expose these fieldnames using underscores to replace
> > > these unwanted characters.
> >
> > That could clash with other field names. I would probably avoid having
> > those kinds of names anyway, but there may be a solution that
> > preserves all names regardless. That is, I don't know if it is
> > feasible or easy to implement, but I know that this type of syntax is
> > valid:
> >
> > var inputs = {};
> > o["name with spaces"] = 1;
> > o["name-with-dahses"] = 2;
> >
> > or, more compact:
> >
> > var inputs = {
> > "name with spaces": 1
> > , "name-with-dashes": 2
> > }
> >
> > So afterwards, you can refer to them as: inputs["name with spaces"]
> >
> > just an Idea - not a big deal for me if it would be replaced with
> > underscores ;)
> >
> > > Any objections?
> > >
> > > All the best,
> > >
> > > --
> > > Matt
> > > ____________________________________________
> > > Matt Casters, Chief Data Integration
> > > Pentaho, Open Source Business Intelligence
> > > http://www.pentaho.org -- mcasters (AT) pentaho (DOT) org
> > > Tel. +32 (0) 486 97 29 37
>
>
>
> --
> Matt
> ____________________________________________
> Matt Casters, Chief Data Integration
> Pentaho, Open Source Business Intelligence
> http://www.pentaho.org -- mcasters (AT) pentaho (DOT) org
> Tel. +32 (0) 486 97 29 37
>
> >
>


--
Roland Bouman
http://rpbouman.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "kettle-developers" group.
To post to this group, send email to kettle-developers (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to kettle-developers-unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/kettle-developers?hl=en
-~----------~----~----~----~------~----~------~--~---