If you need to change the SQL query dynamically, you can use predefined variables. BellaDati currently supports functions to get date, time or timestamp in user defined formats:
Name | Description | Examples |
---|---|---|
| Evaluates the |
|
| Works like |
|
| Evaluates the |
|
| Works like | $time(now, HH:mm:ss) |
| Returns the current time stamp value | $timestamp() |
$lastSuccessfulImport() | Returns time stamp with last successful import | $lastSuccessfulImport() |
| 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_DATE_ATTRIBUTE) //returns 2013-01-01 $firstValue(L_TIME_ATTRIBUTE) //returns 10:00:54 |
| 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_DATE_ATTRIBUTE) //returns 2013-12-31 $lastValue(L_TIME_ATTRIBUTE) //returns 23:59:59 |
$firstValue(DATASET_CODE, L_ATTRIBUTE_CODE) | Returns the lowest value (sorted ascending) of the attribute specified by attribute ID stored in the referenced data set. | $firstValue(NEW_DATA_SET__SQL_DATABAS_4, L_ATT) |
$lastValue(DATASET_CODE, L_ATTRIBUTE_CODE) | Returns the highest value (sorted descending) of the attribute specified by attribute ID stored in the referenced data set. | $lastValue(NEW_DATA_SET__SQL_DATABAS_4, L_ATT) |
When using the variables in the SQL query, you should make sure that the variable is placed in the quotes, so it will be used as string.
An example of such a condition can be: WHERE id > '$lastValue(L_ID)' |
DateString
TimeString