cancel
Showing results for 
Search instead for 
Did you mean: 

Indian Currency Format

former_member192494
Participant
0 Kudos

Hi All,

I have set of 14 text fields, also i have a text view which displays the sum of values entered in 14 text fields.I am able to sum the values entered in the fields, but i need it to be displayed in this format "11,22,33,444". For now i am able to display in this format"112,233,444" How can this be done ?

Thanks and regards,

Ravikiran

Accepted Solutions (1)

Accepted Solutions (1)

koolspy_ultimate
Active Contributor
0 Kudos

Hi Ravi,

You can use the formatter for this purpose.

Please fin the below code already posted by Robin van het hof .

  1. var oTF = new sap.ui.commons.TextField({ 
  2.       value     : 0, 
  3.       textAlign : sap.ui.core.TextAlign.Right, 
  4.       editable  : true, 
  5.       change : function(oEvent) { 
  6. var value = oEvent.getSource().getValue(); 
  7. var floatValue = parseFloat(value); 
  8. var formatter = new Intl.NumberFormat('en-US', { 
  9.           style: "currency", 
  10.           currency: "EUR" 
  11.         }); 
  12. this.setValue(formatter.format(floatValue)); 
  13.       } 
  14.     });

Regards,

Madhumahesh.

former_member192494
Participant
0 Kudos

Hi Madhumahesh,

Thanks for your immediate reply with a help full source.

Its working but i need like "Rs 1,00,000", but i am getting this "100,000".

How can the grouping be done ?

Thanks,

Ravikiran

koolspy_ultimate
Active Contributor
0 Kudos

Hi Ravi,

1) Please explain what you have tried?

2) Did you try changing the currency format to INR?

3) Did you go through this thread Completely -> Check this out

Regards,

Madhumahesh.

former_member192494
Participant
0 Kudos

Hi Madhumahesh,

I tried the same,  I followed same approach.

Yes, i changed the currency to INR, but again the coma appears evenly after every 3 digits.

How can i limit the coma first to 3 digits and then move with 2 digits ?

There is option for indian currency to displayed in all regional languges which is in the format i wanted.

Thanks,

Ravikiran

koolspy_ultimate
Active Contributor
0 Kudos

Hi Ravi,

as mentioned earlier  the document posted by sreehari (link)  is working fine.

Unable to understand why you not able to achieve it.

Can you please post your code, so that it will be helpful to solve your query.

See the sample output below

Regards,

Madhumahesh.

Qualiture
Active Contributor
0 Kudos

Using my version of Chrome (v36 on OS X), setting locale to en-IN and currency to INR I only got it to display

    Rs123.456.789,00

format (so not the Indian separator system) and on IE11 on Win7 it displayed

   ₹123.456.789,00

However, setting the locale to hi-IN resulted in

   रु. १२,३४,५६,७८९

on Chrome and

    ₹ 12,34,56,789.00

on IE11 so depending on your browser, you may see what works best for you

former_member192494
Participant
0 Kudos

Hi Madhumahesh ,

Please find the code  below,

View:

var oVENUE_BUDGET_TF = new sap.ui.commons.TextField(

  'EV_EC_VENUE_BUDGET', {

  width : "200px",

  value : "{EventModel>/VENUEBUDGETF}"

  }).addStyleClass('style0');

  oVENUE_BUDGET_TF.setValue(oNumberFormat.format()); // Set the formatted

  // value on the text

  // field

  oVENUE_BUDGET_TF.attachChange(function() {

  var Val = sap.ui.getCore().byId('EV_EC_VENUE_BUDGET').getValue();

  var Field = sap.ui.getCore().byId('EV_EC_VENUE_BUDGET');

  helpers.prototype.ValidateInteger(Val, Field);

  oController.textFieldNumberFormat1(Field);

  });

Controller:

textFieldNumberFormat1 : function(Field) {

  var value = Field.getValue();

  var floatValue = parseFloat(value);

  var formatter = new Intl.NumberFormat('en-US');// , {

  // style : "currency",

  // currency : "INR"});

  Field.setValue(formatter.format(floatValue));

  console.log(Field);

  },

Thanks,

Ravikiran

former_member192494
Participant
0 Kudos

Hi Robin,

I followed your approach, it works except the positioning of commas. I have a question for you.

So is this browser dependent?

Thanks,

Ravikiran

former_member192494
Participant
0 Kudos

Hi Robin, Madhumahesh,

I see the required  format is working in mozilla firefox.

Thank you Robin and Madhumahesh  for your help

Thanks,

Ravikiran

Answers (0)