1
以下のクエリは、コレクション内のフィールドの合計(「実際」)を計算し、結果をコンソールに正しく表示します。しかし、結果をテキストラベルにどのように埋め込むことができますか?AppceleratorでSUM SQLクエリの結果を出力するには?
var fetchedTranslations = $.translationData;
fetchedTranslations.fetch({
query: 'SELECT SUM (sum_words) FROM "translationsCollection"'
});
console.log("result: " + JSON.stringify(fetchedTranslations)); //result: [{"SUM (sum_words)":42}]
$.wordCounter.text = ; //should show 42
SOLUTION
ときLarrieとして提案名前を変更し、それがへ
var result = fetchedTranslations.toJSON();
$.wordCounter.text = result[0].sum_total;
提案していただきありがとうございます。それはsum_totalにキーを変更しますが、オブジェクトエラーではない未定義を出力します。 – user24957
私も.toJSONメソッドを使う必要がありました。 AS改名について知らなかったありがとう – user24957