Jump to content

Make a number Formated from a unformated number


This topic is 2943 days old. Please don't post here. Open a new topic instead.

Recommended Posts

So I'm confused on a calculation , I'm not sure if I should use a substitute calculation for what I'm trying to do or how to use that calculation by formatting a unformatted number;

Example Unformatted Number 21100

Example Formatted Number 02-1100

So I need to add a "0" in front of the number and then always separate the first two numbers with a "-" the numbers be hide the "-" could be 1 or 20 numbers

Ideas?

Link to comment
Share on other sites

1 hour ago, WSaxton said:

Example Unformatted Number 21100

The example is ambiguous - it would be preferable to state a rule first, then give examples. For example, will the given number always have exactly 5 digits? If not, what is the expected answer in each case?

---

If I am guessing correctly, you want to do:

SerialIncrement ( "00" ; Div ( Number ; 10000 ) ) & SerialIncrement ( "-0000" ; Mod ( Number ; 10000 ) )  

which would format:

1 as "00-0001";
12 as "00-0012";
123 as "00-0123";
1234 as "00-1234";
12345 as "01-2345";
123456 as "12-3456";
1234567 as "123-4567".

 

 

 

Edited by comment
Link to comment
Share on other sites

And if there is always a dash (in the middle) then it truly is not a number so the result calculation should be text.

In fact, I would ask the purpose of this number?  Is it from an export from external source?  I ask because it might be best to auto-enter the correct format to begin with or use OnObjectValidate to assist/force the User in formatting it. 

Edited by LaRetta
Link to comment
Share on other sites

This topic is 2943 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.