Hi Matt,

as my previous speakers said there are different ways in order to achieve the 
goal. One of them could be the function qx.Class.hasProperty [1]

example:
if(qx.Class.hasProperty(object.constructor, element)) { …


[1]          
http://demo.qooxdoo.org/current/apiviewer/#qx.Class~hasProperty!method_public
http://demo.qooxdoo.org/current/apiviewer/#qx.util.OOUtil~hasProperty!method_public

Gruß
Mustafa Sak

Applications & Integration
1&1 Internet AG | Ernst-Frey-Straße 10 | 76135 Karlsruhe | Germany

Von: Matt Davis - NOAA Federal [mailto:matt.w.da...@noaa.gov]
Gesendet: Montag, 16. Februar 2015 01:00
An: qooxdoo-devel@lists.sourceforge.net
Betreff: [qooxdoo-devel] Need some help - Determining Object Property Existence

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

Reply via email to