Commit cdf7359f553652b1b60eaec96add370896f700bb
1 parent
a748d9bc
ala fix temp
Showing
1 changed file
with
11 additions
and
2 deletions
datalets/base-ajax-json-alasql-datalet/static/js/AjaxJsonAlasqlBehavior.js
... | ... | @@ -160,10 +160,19 @@ var AjaxJsonAlasqlBehavior = { |
160 | 160 | for (var i = 0; i < fields.length; i++) { |
161 | 161 | var key = Object.keys(obj[0])[i]; |
162 | 162 | var v = obj[0][key]; |
163 | + //if (!isNaN(v)) | |
164 | + // select += fields[i] + "::NUMBER as " + this._fieldName(this._component.fields[i], "") + ", "; | |
165 | + //else | |
166 | + // select += fields[i] + " as " + this._fieldName(this._component.fields[i], "") + ", "; | |
167 | + | |
168 | + //omg! | |
169 | + var key2 = "["+key+"]"; | |
170 | + if(fields[0].indexOf("->") > -1) | |
171 | + key2 = "fields->["+key+"]"; | |
163 | 172 | if (!isNaN(v)) |
164 | - select += key + "::NUMBER as " + this._fieldName(this._component.fields[i], "") + ", "; | |
173 | + select += key2 + "::NUMBER as " + this._fieldName(key, "") + ", "; | |
165 | 174 | else |
166 | - select += key + " as " + this._fieldName(this._component.fields[i], "") + ", "; | |
175 | + select += key2 + " as " + this._fieldName(key, "") + ", "; | |
167 | 176 | } |
168 | 177 | select = select.slice(0, -2); |
169 | 178 | ... | ... |