16
Views
3
Comments
format number

I have number in this format 

1.5

1.56

i want to format it to

1.5      ===> 1 hour 5 Minutes

1.56   ===> 1 hour 56 minitues


how to do that !! 



Hello Omar,

There is no built-in function to do that, so you'll have to create the logic for this.

My suggestion is that you split the initial string by the dot delimiter... You can do this by using JavaScript if you're working on the client side or the String_Split server action from Text extension if you're working on the server side:


Let's say you have the string "1.5", after this split using "." as a delimiter, you'll have a list with 2 elements:

- String_Split.List[0] -> "1"

- String_Split.List[1] -> "5"

 

After this you just need to create your final string:

String_Split.List[0].Text.Value + "Hours " + String_Split.List[1].Text.Value + "Minutes"


Hope that this helps you!


Kind regards,

Rui Barradas

Hi @Omar AbdElhadi 

please check Below oml

I consider 1.50 as 1 hour and 50 min,

                   1.05 as 1 hour 05 min,

                   2.66 as 3 hour 6 min


   

SoluctionFormate.oml

Hello  Omar AbdElhadi,

Adding to the above solution.

You can also use substring function like you can substring the digits  by decimal places and then you can do concatenation adding Hours and Minutes  string.

Hope this will help you.

Regards

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.