Concatenation
Posted: Wed Jan 09, 2019 4:56 pm
I have a table with the fields representing the number of pills given to a patient at different times of the day.
The calculation below calculates the number of pills given daily x the units with a separate column for the measure of the pill (70mg, 5mg, etc.
If a daily dose is 1 pill in the morning for 70mg/pill, then the total daily dose is 70mg. If 2 pills then 140mg, etc.
The calculation below works as expected.
( "morning" + "afternoon" + "evening" ) * to_number( "units" )
Now I want to add the measure (mg, mcg, tablet) to the calculation result.
Using the sql in the query ( "morning" + "afternoon" + "evening" ) * to_number( "units" )|| "measure" results in a number with many trailing zeros - 250.000000000000000
I need to remove the trailing zeros.
Thank you.
The calculation below calculates the number of pills given daily x the units with a separate column for the measure of the pill (70mg, 5mg, etc.
If a daily dose is 1 pill in the morning for 70mg/pill, then the total daily dose is 70mg. If 2 pills then 140mg, etc.
The calculation below works as expected.
( "morning" + "afternoon" + "evening" ) * to_number( "units" )
Now I want to add the measure (mg, mcg, tablet) to the calculation result.
Using the sql in the query ( "morning" + "afternoon" + "evening" ) * to_number( "units" )|| "measure" results in a number with many trailing zeros - 250.000000000000000
I need to remove the trailing zeros.
Thank you.