inmonth - スクリプトおよびチャート関数
この関数は、timestamp が base_date を含む月にある場合、True を返します。
構文:
InMonth (timestamp, base_date, period_no[, first_month_of_year])
戻り値データ型: ブール値
引数:
引数
timestamp
|
base_date と比較する日付。 |
base_date
|
月の評価に使用する日付。 |
period_no
|
月は period_no によって補正することができます。period_no は整数で、値 0 は base_date を含む月を示します。period_no の値が負の場合は過去の月を、正の場合は将来の月を示します。
|
first_month_of_year
|
first_month_of_year パラメーターは無効化されており、将来使用する目的で予約されています。
|
スクリプトの例
inmonth ('25/01/2013', '01/01/2013', 0 )
|
True を返します |
inmonth('25/01/2013', '01/04/2013', 0)
|
False を返します |
inmonth ('25/01/2013', '01/01/2013', -1)
|
False を返します |
inmonth ('25/12/2012', '01/01/2013', -1)
|
True を返します |
アプリにスクリプト例を追加して実行します。結果を表示するには、結果列に含まれている項目をアプリのシートに追加します。
この例では、period_noに 4 を指定して、請求書日付がbase_dateの月の4か月後の月の範囲内かどうか確認します。
TempTable:
LOAD RecNo() as InvID, * Inline [
InvDate
28/03/2012
10/12/2012
5/2/2013
31/3/2013
19/5/2013
15/9/2013
11/12/2013
2/3/2014
14/5/2014
13/6/2014
7/7/2014
4/8/2014
];
InvoiceData:
LOAD *,
InMonth(InvDate, '31/01/2013', 4) AS InMthPlus4
Resident TempTable;
Drop table TempTable;
結果テーブルには、元の日付と、inmonth() 関数の戻り値の列が含まれています。
結果テーブル
InvDate |
InMthPlus4 |
28/03/2012 |
0 (False) |
10/12/2012 |
0 (False) |
5/2/2013 |
0 (False) |
31/3/2013 |
0 (False) |
19/5/2013 |
-1 (True) |
15/9/2013 |
0 (False) |
11/12/2013 |
0 (False) |
2/3/2014 |
0 (False) |
14/5/2014 |
0 (False) |
13/6/2014 |
0 (False) |
7/7/2014 |
0 (False) |
4/8/2014 |
0 (False) |