successHandleFn: function(oResult) {
var oConfig = this.getView().getModel().getProperty("/config");
this.oDataRequest = undefined;
var oData = oResult,
oDataToDisplay;
oDataToDisplay = sap.ushell.components.tiles.utilsRT.getDataToDisplay(oConfig, oData);
var aKeys = [
// Additional data for our KPI Tile //
"scale", "targetValue", "targetValueLabel", "minValue", "maxValue", "actual", "color", "footer1", "footer2", "unit1", "unit2"
// End additional data //
];
// Prepare emp object:
oResult.results = {};
for (var i = 0; i < aKeys.length; i++) {
//sName = aKeys[i];
if (i === 1 || i === 3 || i === 4 || i === 5) {
oResult.results[aKeys[i]] = parseFloat(oResult[aKeys[i]]);
} else {
oResult.results[aKeys[i]] = oResult[aKeys[i]];
}
}
// Store the additional results back to emp
oDataToDisplay.emp = oResult.results;
// set data to display
this.getView().getModel().setProperty("/data", oDataToDisplay);
// rewrite target URL
this.getView().getModel().setProperty("/nav/navigation_target_url",
sap.ushell.components.tiles.utilsRT.addParamsToUrl(
this.navigationTargetUrl,
oDataToDisplay
));
}
var actual = new sap.suite.ui.microchart.BulletMicroChartData({
value: '{/data/emp/actual}',
color: '{/data/emp/color}'
});
return new sap.m.GenericTile({
header: '{/data/display_title_text}',
subheader: '{/data/display_subtitle_text}',
frameType: "TwoByOne", //TwoByOne
tileContent: [new sap.m.TileContent({
footer: '{/data/emp/footer1}',
unit: '{/data/emp/unit1}',
content: [
new sap.m.NumericContent({
scale: '{/data/display_number_factor}',
value: '{/data/display_number_value}',
truncateValueTo: 5, //Otherwise, The default value is 4.
indicator: '{/data/display_state_arrow}',
valueColor: '{/data/display_number_state}',
icon: '{/data/display_icon_url}',
width: '100%'
})
]
}),
new sap.m.TileContent({
footer: '{/data/emp/footer2}',
unit: '{/data/emp/unit2}',
content: [
new sap.suite.ui.microchart.BulletMicroChart({
scale: '{/data/emp/scale}',
targetValue: '{/data/emp/targetValue}',
targetValueLabel: '{/data/emp/targetValueLabel}',
minValue: '{/data/emp/minValue}',
maxValue: '{/data/emp/maxValue}',
actual: [actual]
})
]
})
],
press: [oController.onPress, oController]
});
METHOD ztiles_num_bt_get_entity.
er_entity = zcl_tile_num_bt=>get_entity( io_tech_request_context ).
ENDMETHOD.
METHOD get_entity.
DATA(wt_keys) = io_tech_request_context->get_keys( ).
TRY.
DATA(w_title) = wt_keys[ name = 'TITLE' ]-value.
DATA(w_method) = REPLACE( val = |GET_ENTITY_{ w_title CASE = UPPER }| regex = '\s' WITH = '_' OCC = 0 ).
CALL METHOD (w_method) RECEIVING rs_entity = rs_entity.
CATCH cx_sy_itab_line_not_found cx_sy_dyn_call_error.
ENDTRY.
ENDMETHOD.
METHOD get_entity_flight_occ.
rs_entity = VALUE #(
icon = 'sap-icon://waiver'
number = '76.5'
numberDigits = '5'
numberFactor = ''
numberState = 'Error' "Positive or Error
numberUnit = '%'
subtitle = 'Dec 2017'
title = 'Fastest Jet Seats Occupancy'
unit1 = '%'
unit2 = '%'
targetValue = CONV ad_percnt3( '85' )
targetValueLabel = '85'
minValue = 0
maxValue = '100'
actual = CONV ad_percnt3( '76.5' )
color = 'Error' "Good or Error
scale = '' ).
ENDMETHOD.
successHandleFn: function(oResult) {
var oConfig = this.getView().getModel().getProperty("/config");
this.oDataRequest = undefined;
var oData = oResult,
oDataToDisplay;
oDataToDisplay = sap.ushell.components.tiles.utilsRT.getDataToDisplay(oConfig, oData);
var aKeys = [
// Additional data for our KPI Tile //
"footer1", "footer2", "unit1", "unit2", "value1", "value2",
"title1", "title2", "displayValue1", "displayValue2", "deltaDisplayValue", "color"
// End additional data //
];
// Prepare emp object:
oResult.results = {};
for (var i = 0; i < aKeys.length; i++) {
//sName = aKeys[i];
if (i === 4 || i === 5) {
oResult.results[aKeys[i]] = parseFloat(oResult[aKeys[i]]);
} else {
oResult.results[aKeys[i]] = oResult[aKeys[i]];
}
}
// Store the additional results back to emp
oDataToDisplay.emp = oResult.results;
// set data to display
this.getView().getModel().setProperty("/data", oDataToDisplay);
// rewrite target URL
this.getView().getModel().setProperty("/nav/navigation_target_url",
sap.ushell.components.tiles.utilsRT.addParamsToUrl(
this.navigationTargetUrl,
oDataToDisplay
));
}
return new sap.m.GenericTile({
header: '{/data/display_title_text}',
subheader: '{/data/display_subtitle_text}',
frameType: "TwoByOne", //TwoByOne
tileContent: [new sap.m.TileContent({
footer: '{/data/emp/footer1}',
unit: '{/data/emp/unit1}',
content: [
new sap.m.NumericContent({
scale: '{/data/display_number_factor}',
value: '{/data/display_number_value}',
truncateValueTo: 5, //Otherwise, The default value is 4.
indicator: '{/data/display_state_arrow}',
valueColor: '{/data/display_number_state}',
icon: '{/data/display_icon_url}',
width: '100%'
})
]
}),
new sap.m.TileContent({
footer: '{/data/emp/footer2}',
unit: '{/data/emp/unit2}',
content: [
new sap.suite.ui.microchart.DeltaMicroChart({
value1: '{/data/emp/value1}',
value2: '{/data/emp/value2}',
title1: '{/data/emp/title1}',
title2: '{/data/emp/title2}',
displayValue1: '{/data/emp/displayValue1}',
displayValue2: '{/data/emp/displayValue2}',
deltaDisplayValue: '{/data/emp/deltaDisplayValue}',
color: '{/data/emp/color}'
})
]
})
],
press: [oController.onPress, oController]
});
METHOD ztiles_num_delta_get_entity.
er_entity = zcl_tile_num_delta=>get_entity( io_tech_request_context ).
ENDMETHOD.
METHOD get_entity.
DATA(wt_keys) = io_tech_request_context->get_keys( ).
TRY.
DATA(w_title) = wt_keys[ name = 'TITLE' ]-value.
DATA(w_method) = REPLACE( val = |GET_ENTITY_{ w_title CASE = UPPER }| regex = '\s' WITH = '_' OCC = 0 ).
CALL METHOD (w_method) RECEIVING rs_entity = rs_entity.
CATCH cx_sy_itab_line_not_found cx_sy_dyn_call_error.
ENDTRY.
ENDMETHOD.
METHOD get_entity_flight_payment.
rs_entity =
VALUE #( icon = 'sap-icon://money-bills'
number = '152'
numberDigits = '4'
numberState = 'Positive' "Positive or Error
numberFactor = 'M'
stateArrow = 'Up' "None, Up or Down
subtitle = 'Dec 2017'
title = 'Fastest Jet Payments'
unit1 = '$'
unit2 = '$'
value1 = '152'
value2 = '147'
title1 = 'Jan 2018'
title2 = 'Jan 2017'
displayValue1 = '142 M'
displayValue2 = '147 M'
deltaDisplayValue = '+5'
color = 'Good' ). "Good or Error
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
37 | |
10 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
2 | |
2 |