篩選資料
1. 篩選特定記錄
.我們正在從表“Student_Table”中,篩選出所有s_no === '3'的資料.
方便起見,你可先運行下面的代碼建立資料表和記錄。
JPocket.add('Student_Table', ['s_no', 's_name']);
JPocket.insert('Student_Table', { s_no: '3', s_name: 'Mary Jesscia' });
var result = JPocket.select('Student_Table',
function load(result) {
if (result.s_no === '3') {
//[mandate]Return true if condition matches,
//[mandate]Otherwise return false
return true;
} else {
return false;
}
});
2.顯示記錄
我們正在顯示在步驟1中已經得到的記錄.
console.log(result);
// s_name:"Mary Jesscia"
// s_no:"3"
Syntax | 句法
Parameter Type | 參數類型:
JPocket.select( String , function load(result) { .... });
Return Value | 返回值類型:
return object
Updated less than a minute ago