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 //
"leftTopLabel", "rightTopLabel", "value1", "value2", "value3", "value4", "color1", "color2", "color3", "color4", "footer1",
"footer2", "unit1", "unit2"
// End additional data //
];
// Prepare emp object:
oResult.results = {};
for (var i = 0; i < aKeys.length; i++) {
if (i === 2 || 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 lefttoplabel = new sap.suite.ui.microchart.ColumnMicroChartLabel({
label: "{/data/emp/leftTopLabel}",
color: "Neutral"
});
var righttoplabel = new sap.suite.ui.microchart.ColumnMicroChartLabel({
label: "{/data/emp/rightTopLabel}",
color: "Neutral"
});
var column1 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value1}",
color: "{/data/emp/color1}"
});
var column2 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value2}",
color: "{/data/emp/color2}"
});
var column3 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value3}",
color: "{/data/emp/color3}"
});
var column4 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value4}",
color: "{/data/emp/color4}"
});
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.ColumnMicroChart({
leftTopLabel: lefttoplabel,
columns: [column1, column2, column3, column4]
})
]
})
],
press: [oController.onPress, oController]
});
METHOD ztiles_num_col4_get_entity.
er_entity = zcl_tile_num_col4=>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.0'
numberDigits = '5'
numberFactor = ''
numberState = 'Error' "Positive or Error
numberUnit = '%'
subtitle = 'FTD 2017'
title = 'Fastest Jet Seats Occupancy'
unit1 = '%'
unit2 = '%'
leftTopLabel = '2017 Q2'
rightTopLabel = '2018 Q1'
value1 = 80
value2 = 70
value3 = 75
value4 = 81
color1 = 'Good'
color2 = 'Error'
color3 = 'Error'
color4 = 'Good' ).
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 //
"leftTopLabel", "rightTopLabel", "value1", "value2", "value3", "value4", "value5", "value6", "value7", "value8", "value9",
"value10", "value11", "value12", "color1", "color2", "color3", "color4", "color5", "color6", "color7", "color8", "color9",
"color10", "color11", "color12", "footer1", "footer2", "unit1", "unit2"
// End additional data //
];
// Prepare emp object:
oResult.results = {};
for (var i = 0; i < aKeys.length; i++) {
if (i === 2 || i === 3 || i === 4 || i === 5 || i === 6 || i === 7 || i === 8 || i === 9 || i === 10 || i === 11 || i === 12 || i ===
13) {
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 lefttoplabel = new sap.suite.ui.microchart.ColumnMicroChartLabel({
label: "{/data/emp/leftTopLabel}",
color: "Neutral"
});
var righttoplabel = new sap.suite.ui.microchart.ColumnMicroChartLabel({
label: "{/data/emp/rightTopLabel}",
color: "Neutral"
});
var column1 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value1}",
color: "{/data/emp/color1}"
});
var column2 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value2}",
color: "{/data/emp/color2}"
});
var column3 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value3}",
color: "{/data/emp/color3}"
});
var column4 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value4}",
color: "{/data/emp/color4}"
});
var column5 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value5}",
color: "{/data/emp/color5}"
});
var column6 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value6}",
color: "{/data/emp/color6}"
});
var column7 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value7}",
color: "{/data/emp/color7}"
});
var column8 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value8}",
color: "{/data/emp/color8}"
});
var column9 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value9}",
color: "{/data/emp/color9}"
});
var column10 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value10}",
color: "{/data/emp/color10}"
});
var column11 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value11}",
color: "{/data/emp/color11}"
});
var column12 = new sap.suite.ui.microchart.ColumnMicroChartData({
value: "{/data/emp/value12}",
color: "{/data/emp/color12}"
});
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.ColumnMicroChart({
leftTopLabel: lefttoplabel,
rightTopLabel: righttoplabel,
columns: [column1, column2, column3, column4, column5, column6, column7, column8, column9, column10, column11, column12]
})
]
})
],
press: [oController.onPress, oController]
});
METHOD ztiles_num_col12_get_entity.
er_entity = zcl_tile_num_col12=>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.0'
numberDigits = '5'
numberFactor = ''
numberState = 'Error' "Positive or Error
numberUnit = '%'
subtitle = 'FTD 2017'
title = 'Fastest Jet Seats Occupancy'
unit1 = '%'
unit2 = '%'
leftTopLabel = 'Apr 2017'
rightTopLabel = 'Mar 2018'
value1 = 81
value2 = 80
value3 = 79
value4 = 75
value5 = 65
value6 = 70
value7 = 76
value8 = 75
value9 = 74
value10 = 77
value11 = 85
value12 = 0
color1 = 'Good'
color2 = 'Good'
color3 = 'Error'
color4 = 'Error'
color5 = 'Error'
color6 = 'Error'
color7 = 'Error'
color8 = 'Error'
color9 = 'Error'
color10 = 'Error'
color11 = 'Good'
color12 = 'Neutral' ).
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 |
---|---|
10 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 | |
4 |