Data Conversion

I am having a string (0days 1 hours 5 min) = calculate in mins. clicking on Get Minutes button it must give it total min.

How should I do that. Please share sample .oml

Hi Rohan Roy, 

Check out the new OML

regarding your question, I have changed the code to cope your use cases.

Just added in the prepareInfo action the replace "minutes" by # to be able to parse.



Notice that spaces are replaced as well with ""

In the output there is a conversion from texttointeger so

0 or 00 will come 0

01 or 1 will come 1 and so on


usage



Just to a debug to understand the logic

Hope that it helps you.

 








Samplev2.oml

Hi Rohan,

to achieve the result you want you need a fixed format for the string.

You presented this format:

  • 0days (no space between, days is plural)
  • 1 hours (space between, hours is plural)
  • 5 min (space between, min is single)

Is it the right format or shouldn't be a pattern of spaces between and plural/single?

Is there any limitation regarding the max number of days, hours or minutes?

Hi Jose,

will u please send the sample .oml for fix format for the string

Rohan, I asked you 2 questions to help you with your problem. Without any of the answers I can't provide a solid solution. 

Hi Rohan,

Can you provide the exact string, you need to calculate minutes from?


Thanks

Hi Rohan Roy,

Check out the OML

I have prepared 2 actions

1.PrepareInfo - prepare received string to output

Days

Hours

Minute

adapt and replace by # accordingly to your string   

in this case 

days 

hours

min are Replaced by #


Spaces are removes as well


String_Split is done by  #


2.CalculateMinutes


Calculatation is based on 

Days

Hours

Minutes

result is

(Days*24 *60) + (Hour *60) +Minute


Check samples usage



Hope that it solves your issue


Sample.oml

Hi Alexander,

Thanks it help me.

But if I give the input as (00 days 01 hours 05 minutes) or (0 days 1 hours 5 minutes)

then how to do this?

I 'liked' your post for still trying to help the OP after he chose to ignore your questions.

Hi Rohan Roy, 

Check out the new OML

regarding your question, I have changed the code to cope your use cases.

Just added in the prepareInfo action the replace "minutes" by # to be able to parse.



Notice that spaces are replaced as well with ""

In the output there is a conversion from texttointeger so

0 or 00 will come 0

01 or 1 will come 1 and so on


usage



Just to a debug to understand the logic

Hope that it helps you.

 








Samplev2.oml

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