Skip to main content
Nintex Community Menu Bar
Solved

Extract number before decimal point

  • October 31, 2023
  • 6 replies
  • 601 views

Forum|alt.badge.img+10

I am trying to extract the number before a decimal point but keep it as an integer. I have found posts about how to extract numbers, but they all convert them to text. I can’t seem to come up with the needed Regex formula, but I guess there might be another solution?

I would like to convert something like 2023.0 to just 2023.

Best answer by aak1

I just realized that when I upgraded this workflow from O365 to NAC it converted that variable to a decimal. I just created a new integer variable and replaced the old variable. I’m a little slow sometimes :(

 

It is working now.

6 replies

bamaeric
Forum|alt.badge.img+14
  • Apprentice
  • October 31, 2023

Are you trying to do this in a workflow or on a form?


Forum|alt.badge.img+10
  • Author
  • Scholar
  • October 31, 2023

On a workflow in NAC.


bamaeric
Forum|alt.badge.img+14
  • Apprentice
  • October 31, 2023

Try adding and configuring a “Apply a regular expression” action in your workflow with the following settings:

  • Input text = Your number data (form field, variable, etc.)
  • Operation = Extract
  • Pattern = (\d)(?=\.)
  • Ignore case = Yes
  • Store first result in = intDigit  (workflow variable of type Integer)

 


Forum|alt.badge.img+10
  • Author
  • Scholar
  • October 31, 2023

Thanks. It does strip out the “.0” but also only leaves the last number before the decimal point. So 2023.0 just becomes “3”.


Forum|alt.badge.img+10
  • Author
  • Scholar
  • Answer
  • October 31, 2023

I just realized that when I upgraded this workflow from O365 to NAC it converted that variable to a decimal. I just created a new integer variable and replaced the old variable. I’m a little slow sometimes :(

 

It is working now.


bamaeric
Forum|alt.badge.img+14
  • Apprentice
  • October 31, 2023

Sorry, I misread your original post.

Glad it is working now for you.