完全なフィールドを持つテーブル「製品」があります。ある条件で値を見つけて取得しようとします。これはJavaScriptファイルです
var APPLICATION_ID = "id",
SECRET_KEY = "key",
VERSION = "v1";
Backendless.initApp(APPLICATION_ID, SECRET_KEY, VERSION);
function Products(args) {
args = args || {};
this.id_user = args.id_user || "";
this.cal = args.cal || null;
this.id_day = args.id_day || null;
this.id_product = args.id_product || null;
this.nameProduct = args.nameProduct || "";
}
var productStorage = Backendless.Persistence.of( Products );
var query = {
condition : "id_day = 33"
}
function get(){
try{
var product = productStorage.find(query).data;
}catch( e )
{
if( e.code != 1009 )
alert(e.message);
}
return [];
}
var array = get();
alert(array[0]);
警告メッセージでは、「未定義」と表示されます。また、関数「get()」のcatchブロックにも問題はありません。