Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Sv translation
languageja

日付と時刻変数

SQLクエリーを大々的に変更する必要がある場合、既定義の 変数を使用できます。BellaDatiは現在、日付、時刻、時刻表示をユーザー定義の形式で得る機能をサポートしています:

名前

説明

$date(dateString)

ddateStringを評価、日付をyyyy-MM-dd 形式でアウトプットします。dateString

$date(now + 5d -4w)
$date(2011-01-01 + 5d -4w)
$date(actualMonth -1d)

$date(dateString, format)

$date(dateString)のように作用しますが、 アウトプット形式はformatパラメーターにコントロールされます。

$date(now + 5d -4w, dd-MM-yyyy)
$date(2011-01-01 + 5d -4w, MMyyyy)
$date(actualMonth -1d, yyyy-dd-MM)

$time(timeString)

timeString を評価し、結果時間をHH:mm:ss形式でアウトプットします。

$time(now)
$time(actualhour)
$time(actualminute)

$time(timeString, format)

$time(timeString)のように作用しますが、 アウトプット形式はformatパラメーターによってコントロールされます。 

$time(now, HH:mm:ss)
$time(actualhour, MMss)
$time(actualminute, HHmmss)

$timestamp()

現在の時刻表示値を返却します。

$timestamp()
$lastSuccessfulImport()
最後のインポート完了で時刻表示を返却します。
$lastSuccessfulImport()

$firstValue(L_ATTRIBUTE_CODE)

特定の変数の最低値(昇順)を、現在のデータセットに蓄積されている変数 IDによって返却します。

データがない場合または変数コードが無効である場合、空文字列を返却します。

$firstValue(L_ID) //returns 123456

$firstValue(L_DATE_ATTRIBUTE) //returns 2013-01-01
$firstValue(L_TIME_ATTRIBUTE) //returns 10:00:54

$lastValue(L_ATTRIBUTE_CODE)

特定の変数の最高値(降順)を、現在のデータセットに蓄積されている変数 IDによって返却します。

データがない場合または変数コードが無効である場合、空文字列を返却します。

$lastValue(L_ID) //returns 123456

$lastValue(L_DATE_ATTRIBUTE) //returns 2013-12-31
$lastValue(L_TIME_ATTRIBUTE) //returns 23:59:59

DateString

  • now – 日付を表します。
  • actualyear– 年の最初の日を表します。 (1.1.20XX) 例えば、21.9.2010で選択されたactualyearは日付 1.1.2010を表します。
  • actualquarter 四半期の最初の日を表します(1.1.20XX, 1.4.20XX, 1.7.20XX, 1.10.20XX)。例えば、21.9.2010で選択されたactualquarterは日付1.7.2010を表します。
  • actualmonth -月の最初の日を表します(1.1.20XX, 1.2.20XX, ...)。例えば、21.9.2010で選択されたactaulmonthは日付1.9.2010を表します。
  • actualweek -週の最初の日を表します(月曜日) 例えば、21.9.2010で選択されたactualweekは日付20.9.2010 (この週の月曜日)を表します。
  • availableFrom, availableTo –データ入力の利用可能な最初と最後の日を表します
  • 絶対的な日付入力は、操作者がこの構文を使うことで調整できます: date +|- n[d|w|m|q|y] nが整数の時、d は日、 w は週、m は月、qは四半期、yは年を表します。例えばこのように定義できます:  actualyear + 2m -4d今日は21.9.2010であるため、このバリューは1.1.2010 + 2 months - 4 days、つまり日付は25.2.2010を表します。

TimeString

  • now 時刻を表します。
  • actualhour -時間を0分と0秒で表します。
  • actualminute -分を0秒で表します。
  • actualsecond -秒を表します。
Sv translation
languagede

Verwenden von Variablen in einer SQL-Abfrage [Original Seitentitel]

 Datums- und Zeitvariablen

Wenn Sie die SQL-Abfrage dynamisch ändern müssen, können Sie vordefinierte Variablen verwenden. BellaDati unterstützt derzeit Funktionen zum Abrufen von Datum, Uhrzeit oder Zeitstempel in benutzerdefinierten Formaten:

Name

Beschreibung

Beispiel

$date(dateString)

Evaluates the dateString and outputs the date in yyyy-MM-dd format. The dateString

$date(now + 5d -4w)
$date(2011-01-01 + 5d -4w)
$date(actualMonth -1d)

$date(dateString, format)

Works like $date(dateString), but output format is controlled by format parameter

$date(now + 5d -4w, dd-MM-yyyy)
$date(2011-01-01 + 5d -4w, MMyyyy)
$date(actualMonth -1d, yyyy-dd-MM)

$time(timeString)

Evaluates the timeString and outputs the resulting time in HH:mm:ss format

$time(now)
$time(actualhour)
$time(actualminute)

$time(timeString, format)

Works like $time(timeString), but output format is controlled by format parameter

$time(now, HH:mm:ss)
$time(actualhour, MMss)
$time(actualminute, HHmmss)

$timestamp()

Returns the current time stamp value

$timestamp()
$lastSuccessfulImport()
Returns time stamp with last successful import
$lastSuccessfulImport()

$firstValue(L_ATTRIBUTE_CODE)

Returns the lowest value (sorted ascending) of the attribute specified by attribute ID stored in the current data set.

Returns empty string if there are no data or the attribute code is not valid.

$firstValue(L_ID) //returns 123456

$firstValue(L_DATE_ATTRIBUTE) //returns 2013-01-01
$firstValue(L_TIME_ATTRIBUTE) //returns 10:00:54

$lastValue(L_ATTRIBUTE_CODE)

Returns the highest value (sorted descending) of the attribute specified by attribute ID stored in the current data set.

Returns empty string if there are no data or the attribute code is not valid.

$lastValue(L_ID) //returns 123456

$lastValue(L_DATE_ATTRIBUTE) //returns 2013-12-31
$lastValue(L_TIME_ATTRIBUTE) //returns 23:59:59
Note

Wenn Sie die Variablen in der SQL-Abfrage verwenden, sollten Sie sicherstellen, dass die Variable in Anführungszeichen gesetzt wird, damit sie als Zeichenfolge verwendet wird.
 

Ein Beispiel für eine solche Bedingung kann sein: WHERE id> '$ lastValue (L_ID)'

DateString

  • now - repräsentiert das aktuelle Datum
  • actualyear - repräsentiert den ersten Tag des tatsächlichen Jahres (1.1.20XX). Beispielsweise repräsentiert das am 21.9.2010 ausgewählte aktuelle Jahr das Datum 1.1.2010
  • actualquarter - stellt den ersten Tag des tatsächlichen Quartals dar (1.1.20XX, 1.4.20XX, 1.7.20XX, 1.10.20XX). Beispielsweise entspricht das am 21.9.2010 ausgewählte aktuelle Quartal dem Datum 1.7.2010
  • actualmonth - stellt den ersten Tag des aktuellen Monats dar (1.1.20XX, 1.2.20XX, ...). Beispiel: tatsächlicher Monat, ausgewählt am 21.9.2010, entspricht dem Datum 1.9.2010
  • actualweek - repräsentiert den ersten Tag der tatsächlichen Woche (Montag). Beispielsweise repräsentiert die am 21.9.2010 ausgewählte tatsächliche Woche das Datum 20.9.2010 (Montag dieser Woche im Kalender)
  • availableFrom, availableTo - represents the first and last available date entry
  • relative and absolute enterig of date can be adjusted by operators using this syntax: date +|- n[d|w|m|q|y], where n is integer, d represents day, w represents week, m represents month q represents quartal and y represents year. We can for example define time in this way:  actualyear + 2m -4d. Today is 21.9.2010, so this value represents 1.1.2010 + 2 months - 4 days, which means date 25.2.2010.

TimeString

  • now - represents actual time
  • actualhour - represents the actual hour at 0 minutes and 0 seconds.
  • actualminute - represents the actual minute at 0 seconds
  • actualsecond - represents the actual second