qooxdoo brings It's own method for capitalizing the first letter of a
string, so you would write:
var methodName = 'get'+qx.lang.String.firstUp(theRawPropertyID);
You could even be smarter by checking if the "introspected" method is a
function:
if(qx.lang.Type.isFunction(object[methodName])) {
value = object[methodName].call(object);
return value;
}
else {
return null;
}
Am 16.02.2015 um 08:42 schrieb Dietrich Streifert:
Hi Matt,
the simpliest solution would be to write:
var theRawPropertyID = 'dewpoint';
var methodName = 'get'+capitaliseFirstLetter(theRawPropertyID);
if(object[methodName]) {
value = object[methodName].call(object);
return value;
} else {
return null;
}
where capitaliseFirstLetter is a yet to write function
(http://stackoverflow.com/questions/1026069/capitalize-the-first-letter-of-string-in-javascript)
Regards
Dietrich
Am 16.02.2015 um 01:00 schrieb Matt Davis - NOAA Federal:
Hi Qooxdoo team and contributors,
I use Qooxdoo in relation to a massive project of the U.S. National
Weather Service. We're not exactly new to Qooxdoo, we've been using
qx since 1.x, and our frontend is around 875k lines. Your project is
outstanding, and helping to protect the public. Thank you!
I've run into something likely above my knowledge level, and seem to
be getting results I cannot debug.
We have a qx object model of a weather/earth science observation. It
may have some number of several hundred possible properties.
I need to determine if the property exists, and if so, whether it
meets certain criteria.
I've read all I can on how this works and am still baffled. In some
cases, I can have results of which a console.log of the typeof
returns nothing, not null, not undefined, just nothing. This is
throwing our various conditionals into fits. I'd thought I'd fixed it
with catching the qxobject.get(element) error to determine existence,
but this too is throwing strange results. I have tried the 'in'
operator and the 'hasOwnProperty' method without success.
The basic code is something like thing this. Element would be the raw
property ID. For instance, if the object has a 'getDewpoint()'
method, element would be 'dewpoint'.
try {
if (object.get(element)) {
value = object.get(element);
return value;
} else {
// No element assigned
return null;
} catch(error) {
// It appears element was not set on object, so also return null
return null;
}
I'm sure I'm missing something here. Consider several hundred
observations being sent through a member function
encasing the above code. As a programmer, I'd expect either the value
or null, but logging it every way I know how shows
it justing "skipping" values with no element.
I'm hoping someone can enlighten me on my misunderstanding of this.
Thank you much,
Matt
--
/Iris, iNWS, and Impact Catalog Technical Lead/
/OS&T/MDL/DAB/
La Crosse, Wisconsin
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel