Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.

Convert text to number

JAGBI
6 - Meteoroid

Hi All,

 

I have the data in the table below and trying to generate the column Puff Per Day based on the text in the MedicationDirection column.

 

Any ideas how this can be achieved please?

 

MedicationDirectionsPuff Per DayNote
Inhale TWO puffs by mouth daily2 
Inhale TWO puffs by mouth daily as directed by the doctor2 
Shake well and inhale 1 puff by mouth TWICE daily l142 
Shake well and inhale 1 puff by mouth Use as directed by the doctor0No duration so value is 0
Shake well and inhale 1 puff by mouth in the morning1 
Shake well and inhale 2 puffs by mouth THREE times daily6 
Shake well and inhale 2 puffs by mouth every EIGHT hours when required624 hrs / 8 hrs * 2
Shake well and inhale 2 puffs by mouth every FOUR hours when required8 
Shake well and inhale 2 puffs by mouth every SIX hours when required12 
Shake well and inhale 2-4 puffs by mouth at once when necessary0No duration so value is 0
Shake well and inhale 2-4 puffs by mouth every SIX hours when required Use as directed by the doctor1224 hrs/6 hrs * 3 (avg puffs)
Shake well and inhale EIGHT puffs by mouth every FOUR hours as directed by your physician4824 hrs /4 hrs * 8 puffs
Shake well and inhale ONE to TWO puffs by mouth TWICE a day  
Shake well and inhale ONE to TWO puffs by mouth TWICE a day *Rinse mouth with water after each use*31.5 puff x 2 times a day
Shake well and inhale TWO puffs by mouth FOUR times a day as directed when necessary8 
Shake well and inhale TWO puffs by mouth TWICE a day4 

 

 

 

Thanks

Jag

3 REPLIES 3
TarunDeep
8 - Asteroid

Hi @JAGBI ,

I was able to build a solution using Regex and formula tools.

It gives Quantity for all the records.

Please check if that serves the purpose. Mark it as a solution if it solves the problem.

JAGBI
6 - Meteoroid

Hi Tarun,

 

This is great help. Would you be able to help with the below in RED as well please

 

texttonumber.JPG

 

MedicationDirectionsPuff Per DayNote
Inhale TWO puffs by mouth daily2 
Inhale TWO puffs by mouth daily as directed by the doctor2 
Shake well and inhale 1 puff by mouth TWICE daily l142 
Shake well and inhale 1 puff by mouth Use as directed by the doctor0No duration so value is 0
Shake well and inhale 1 puff by mouth in the morning1 
Shake well and inhale 2 puffs by mouth THREE times daily6 
Shake well and inhale 2 puffs by mouth every EIGHT hours when required624 hrs / 8 hrs * 2
Shake well and inhale 2 puffs by mouth every FOUR hours when required8 
Shake well and inhale 2 puffs by mouth every SIX hours when required12 
Shake well and inhale 2-4 puffs by mouth at once when necessary0No duration so value is 0
Shake well and inhale 2-4 puffs by mouth every SIX hours when required Use as directed by the doctor1224 hrs/6 hrs * 3 (avg puffs)
Shake well and inhale EIGHT puffs by mouth every FOUR hours as directed by your physician4824 hrs /4 hrs * 8 puffs
Shake well and inhale ONE to TWO puffs by mouth TWICE a day0 
Shake well and inhale ONE to TWO puffs by mouth TWICE a day *Rinse mouth with water after each use*31.5 puff x 2 times a day
Shake well and inhale TWO puffs by mouth FOUR times a day as directed when necessary8 
Shake well and inhale TWO puffs by mouth TWICE a day4 
Inhale ONE dose by mouth daily #SC47111 
shake well and inhale 2 puffs by mouth morning and night4 
inhale 1 dose puff in the morning and take 2 puffs at night3 
inhale 1 dose by mouth daily - *regular dosage essential* #sc47111 

 

 

 

 

Thanks

Jag

TarunDeep
8 - Asteroid

PFA the new solution, simple to split the string using RegEx. and use filters for directing the results.