cancel
Showing results for 
Search instead for 
Did you mean: 

Number Format Mask Question

Former Member
0 Kudos

Hi guys, i´m trying to use a number mask because I want to set a mask from a number field, in other way I don´t want to change the type of the field to text because I expect always numbers and in VC I can´t found the way to validate with regex.

So, the problem is when I set the mask in the value field, it´s turn automatically to read-only, so at runtime the user can´t set a value and then makes the system format it.

How the format thing works in VC !?

Is the right place to use the format functions !?

Any help will be appreciated.

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hi Isaak,

you have to set the currency not IN the input field, but beside the input field you can make a further input field for the currency.

If you want your number without formating of the number you have to use text fields otherwise it will be formated.

My problem is and maybe Talia can help me:

I want to format my table column so, that I see always one decimal place and it should be sortable.

Do you have for this issue any idea?

BR,

Murat Y.

talia_gurevich
Participant
0 Kudos

Hi Murat,

If the table is populated by a service, you can use the same approach I described in my first reply to Isaac (with data share and the formatting on the map).

In order to define the number of digits after the decimal point, you should use NSTR with .m parameter. In your case you should use .1 in order to show 1 decimal digit.

Number Formatting Mask in Visual Composer:

http://help.sap.com/saphelp_nwce711/helpdata/en/48/a8e149516b35bae10000000a42189d/content.htm

Thanks,

Talia

0 Kudos

Hi Talia,

yes I use NSTR with .1 in the mapping to the data share and the colums is still a number columns and sorting is working.

BUT in runtime the values with 0 decimal place at the end are shown as in integer without decimal places.

talia_gurevich
Participant
0 Kudos

Hi Murat,

We've looked into it now and the conclusion is that this is the default behavior of WebDynpro Framework.

WebDynpro displays BigDecimals in this way (if it is 3.0, it will display it as 3).

Unfortunately, there is not quick solution for this issue. This is added to our feature request list and we will address this issue according to our capacity and priorities.

Thanks,

Talia

0 Kudos


Thanks Talia,

this is very very important for formatted reporting/dashboards. Please put this with prio high on your list for VC5.

BR,

Murat

talia_gurevich
Participant
0 Kudos

Hi Murat,

Sure, I spoke with Kobi right now.

We put it in our features list for VC5 with High priority.

Thanks,

Talia

talia_gurevich
Participant
0 Kudos

Hi Isaac,

When you set the mask in the value field, it´s turn automatically to read-only.

The reason this happens is since the calculated field you define is

treated as text, because it does not have a matching "real" field in the

data set.

Where does the value of field @FacturaSAP come from?

Does it comes from a service?

If so, you can do the following:

  1. Drag a "Data Share" (lets call it share1) element from the "Compose" panel. Connect the output port of the service to it.
  2. Open Define Data dialog of share1
  3. Add two new fields:

          TXT1 (text field)

          NUM1 (numeric field)

   4. Open Map Data dialog of the mapping line between the output of the service and the share1

    5.     Define the Assign values of the new fields as following:


TXT1       =NSTR(@FacturaSAP ,"<ANYMASK>")

NUM1   =NVAL(share1@TXT1)

6. Create some UI element (FormView or GridView) using quick link from share1. This UI element will contain the InputField that will be bound to NUM1 and will display the number in the needed formatting.

I attached a screenshot of model example for your reference. There is another mask in the example, but in does not matter in this case.

Hope it helps.

If the value of field @FacturaSAP does not come from a service, please attach a screenshot with the model and brief explanation of the use case.

Thanks,

Talia

Former Member
0 Kudos

Hi Talia, thank you for your great answer, the field @FacturaSAP is an input field that the user enter manually in a view called..."2", then, the user enters the value 400000000, and after that the user could contine to the following views #3 #4 etc, (within a wizard) but if the user return to view #2 the value entered as 400000000 now is represented as 400,000,000 ... all I want is to format this input field to replace the commas.

The other scenario is almost the same but imagine that I want to set the currency in that field, the user in the view #2 set 4000000 and when the user press enter the currency is now set with the proper function mask, or maybe they don´t need to press enter but he navigates to the view #3 #4, and maybe if he returns to view #2 the value 400000 now formatted with the currency.

In your example if I´m understanding, the format functions only can be set inside the mapping !?

tHnks

talia_gurevich
Participant
0 Kudos

Hi Isaac,

The solution of formatting in the mapping will be good if the values come from a service.

In your case the formatting of numbers is done automatically per current locale.

I am not sure there is a way to overcome it.

Thanks,

Talia