Skip to main content
June 20, 2022
Question

Mathematical comparison between two values (Text type)

  • June 20, 2022
  • 3 replies
  • 0 views

What would be the best way to conclude which of the two values ( text type ) is higher ? 

touniformstring(1500000)<touniformstring(14285714) : this is returning as false . ( O/P should be True for mathematically to be correct )

touniformstring(1245) < touniformstring(2234) : This is returning as true as expected . 

Is there any other idea to compare two text type value's to find out which is higher ? 

P.S : The value is of text type . Changing the value to a number or decimal is out of scope . 

3 replies

stefanhelzle0001
Brainy
June 20, 2022

Hm .... mathematics works with numbers, not strings.

Can you explain your use case and why a cast to a decimal is not "allowed"?

June 20, 2022

Hi Stefan ,

Use case is similar to the question raised . Not in a position to use decimal function (The field is maintained as a Text type )

67658889*2.6 = 1.759131e+08(Number (Decimal))

to overcome the above , the field is maintained as a text type . Now there is a case where we need to fetch values greater than X from DB . Unfortunately the field is of type text . 

Any suggestions or any more inputs needed ? 

stefanhelzle0001
Brainy
June 20, 2022

I do not understand the issue to overcome. The mentioned calculation is correct and you use fixed() or text() to display that value to the user.

So, I think that you could create a view in the DB to cast  the values to numbers and then query this view.