setting.where
WHERE節
例1 where : [ { '列名' : '条件' } , '&&' , { '列名' : '条件' } , ...n ]
例2 where : [ [ 列番号 , '条件' ] , '&&' , [ 列番号 , '条件' ] , ...n ]
[]記号の意味は省略可ではなくJavaScript配列。列番号は0から始まる連番。'列名'はStringで与えるためクオート('か")で囲み、列番号はNumberであり囲まない。
数値
数値 (三桁カンマ)
文字列
複数条件 ('&&'がAND '||'がOR)
否定
like
like パーセント記号 (%でワイルドカード あいまい検索)
like アンダスコア記号 (_で1 つの文字と一致)
like エスケープ (\\で%と_をエスケープ)
./data/where1.csv
NO,名前,種類,年齢,金額
1,アイ,さる,10,"100,000"
2,タマ,ねこ,5,"80,000"
3,チャー,いぬ,12,"5,000,000"
4,アー,子豚,3,"50,000"
5,イー,イタチ,2,"50,000"
6,ガー,金魚3%だ,1,"5,000"
7,ミケ,カメ,5,"20,000"
8,ポチ,_ト_ラ_,2,"10,000"
9,トム,ライオン,2,"2,000"
10,メリー,いぬ,5,"80,000"
11,トト,しゃけ,2,"60,000"
12,ポンタ,タヌキ,2,"60,000"
13,ビィ,金魚300%なのだ,3,"50,000"
14,ポー,ハト_ラバ,8,"10,000"
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="content-script-type" content="text/javascript">
<meta http-equiv="content-style-type" content="text/css">
<!--[if IE]>
<script src="./js/excanvas/excanvas-compressed.js" type="text/javascript" ></script>
<![endif]-->
<script src="./js/jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="./js/jquery.csv2table-0.02-b-2.3.js" type="text/javascript" charset="utf-8"></script>
<hr>数値<br>
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'年齢':'==5'}]
});"
value="where : [{'年齢':'==5'}]">
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'年齢':'<8'}]
});"
value="where : [{'年齢':'<8'}]">
<ul>列番号(0からはじまる連番)で指定する <span style='font-size:0.8em'>(*配列で記述します)</span>
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [[3,'<=2']]
});"
value="where : [[3,'<=2']]"> <br>
where + orderBy
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'金額':'>=50000'}],
orderBy : [[4,'D']]
});"
value="where : [{'金額':'>=50000'}] , orderBy : [[4,'D']]">
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [[3,'<=5']],
orderBy : [[4,'A']]
});"
value="where : [[3,'<=5']], orderBy : [[4,'A']]">
<br>
select + where + orderBy
<span style='font-size:0.8em'>(*where,orderByのindexは select後の連番で記述します)</span>
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
select : [1,2,3,4],
where : [{'年齢':'==2'}],
orderBy : [[3,'A']]
});"
value="select:[1,2,3,4],where : [{'年齢':'==2'}] , orderBy : [[3,'A']]">
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
select : [1,2,3,4],
where : [[2,'<=3']],
orderBy : [[3,'D']]
});"
value="select:1,2,3,4],where : [[2,'<=3']] , orderBy :[[3,'D']]">
</ul>
<hr>数値 (三桁カンマ)<br>
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'金額':'<=20000'}]
});"
value="where : [{'金額':'<=20000'}]">
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'金額':'<=20,000'}]
});"
value="where : [{'金額':'<=20,000'}]">
<hr>文字列<br>
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'名前':'==アイ'}]
});"
value="where : [{'名前':'==アイ'}]">
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'種類':'==いぬ'}]
});"
value="where : [{'種類':'==いぬ'}]">
<hr>複数条件 ('&&'がAND '||'がOR)<br>
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'NO':'<3'},'&&',{'年齢':'>=10'}]
});"
value="where : [{'NO':'<3'},'&&',{'年齢':'>=10'}]">
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'NO':'==5'},'||',{'種類':'==カメ'}]
});"
value="where : [{'NO':'==5'},'||',{'種類':'==カメ'}]">
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'NO':'==5'},'||',{'種類':'==カメ'},'&&',{'年齢':'<3'}]
});"
value="where : [{'NO':'==5'},'||',{'種類':'==カメ'},'&&',{'年齢':'<3'}]">
<hr>否定<br>
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'NO':'!=5'}]
});"
value="where : [{'NO':'!=5'}]">
<hr>
<div style="padding:5px;margin:5px;border:5px solid gold">
<!-- ここへ表出力 -->
<div id="viewSettingWhere"></div>
</div>
<hr>like<br>
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'種類':'like イタチ'}]
});"
value="where : [{'種類':'like イタチ'}]">
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'種類':'like イタ'}]
});"
value="where : [{'種類':'like イタ'}]">
<hr>like パーセント記号 (%でワイルドカード あいまい検索)<br>
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'種類':'like イタ%'}]
});"
value="where : [{'種類':'like イタ%'}]">
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'種類':'like %タ%'}]
});"
value="where : [{'種類':'like %タ%'}]">
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'金額':'like 5%0'}]
});"
value="where : [{'金額':'like 5%0'}]">
<hr>like アンダスコア記号 (_で1 つの文字と一致)<br>
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'種類':'like タ__'}]
});"
value="where : [{'種類':'like タ__'}]">
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'名前':'like チ_ー'}]
});"
value="where : [{'名前':'like チ_ー'}]">
<hr>like エスケープ (\\で%と_をエスケープ)<br>
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'種類':'like 金魚3%だ'}]
});"
value="where : [{'種類':'like 金魚3%だ'}]">
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'種類':'like 金魚3\\%だ'}]
});"
value="where : [{'種類':'like 金魚3\\%だ'}]">
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'種類':'like _ト_ラ_'}]
});"
value="where : [{'種類':'like _ト_ラ_'}]">
<input
class="btn1"
type = "button"
onclick="$('#viewSettingWhere').csv2table('./data/where1.csv',{
where : [{'種類':'like \\_ト\\_ラ\\_'}]
});"
value="where : [{'種類':'like \\_ト\\_ラ\\_'}]">
<hr>