In questo esempio, per ogni transaction_date nella tabella viene creato un valore Returnable_Until. Il valore di Returnable_Until viene calcolato spostando il mese della data transaction_date a un mese dopo.
Nell'editor caricamento dati creare una nuova sezione, aggiungere lo script di esempio ed eseguirlo. Aggiungere quindi a un foglio nell'app almeno i campi elencati nella colonna dei risultati per visualizzare il risultato.
Script di caricamento
SET DateFormat='YYYYMMDD';
SET TimestampFormat='YYYYMMDD h:mm:ss[.fff] TT';
SET FirstMonthOfYear=1;
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET LongMonthNames='January;February;March;April;May;June;July;August;September;October;November;December';
Transactions:
Load
*,
MonthName(Date#(transaction_date,'YYYYMMDD'), 1) as Returnable_Until,
;
Load * Inline [
transaction_id, transaction_date, transaction_amount, transaction_quantity, discount, customer_id, size, color_code
3750, 20180830, 12423.56, 23, 0,2038593, L, Red
3751, 20180907, 5356.31, 6, 0.1, 203521, m, orange
3752, 20180916, 15.75, 1, 0.22, 5646471, S, blue
3753, 20180922, 1251, 7, 0, 3036491, l, Black
3754, 20180922, 21484.21, 1356, 75, 049681, xs, Red
3756, 20180922, -59.18, 2, 0.333333333333333, 2038593, M, Blue
3757, 20180923, 3177.4, 21, .14, 203521, XL, Black
];
Risultati
Qlik Sense table showing results of the monthname function being used in the load script.
transaction_id |
transaction_date |
Returnable_Until |
3750 |
20180830 |
Sep 2018 |
3751 |
20180907 |
Oct 2018 |
3752 |
20180916 |
Oct 2018 |
3753 |
20180922 |
Oct 2018 |
3754 |
20180922 |
Oct 2018 |
3756 |
20180922 |
Oct 2018 |
3757 |
20180923 |
Oct 2018 |