Skip to Content

How to Split String in Master Detail Fiori app?

Hello All,

I need your expert review for following issue,

From SAP Backend Xdata = "85274|AC|Air|FS"

How to get value Air from this string?

Please find my code below,

In Controller How i can get this value so that i can modify it?

Thanks in Advance

From SAP Backend Xdata = 85274|AC|Air|FS

In Detail.view.xml
<Label text="Customer  No"/>
<Label text="{ path:'{Xdata}',formatter:'.formatLabel'}"/>

In Controller
formatLabel: function (oDataString) {

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Feb 08 at 06:59 AM

    Have a look at the split function of Strings:

    In your formatter you could do the following:

    formatLabel: function(oDataString) {
      return oDataString.split("|")[2] || "";
    Add comment
    10|10000 characters needed characters exceeded

    • Hello,

      If you write ES6 code you can initialize your oDataString parameter in the signature of your function, e.g. with an emtpy string:

      formatLabel: function (oDataString = "") {
        return oDataString.split("|")[2] || "";

      Otherwise you have to check if the incoming parameter and handle the critical cases. For example:

      formatLabel: function (oDataString) {
        var formattedString = "";
        if (oDataString !== undefined && oDataString !== null) {
          formattedString = oDataString.split("|")[2] || "";
        return formattedString;

      If you need some Javascript lecture, you can visit some pages, like:, or