Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8254611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:15:02+00:00 2026-06-08T01:15:02+00:00

I am looking for a way that would allow me to have a column

  • 0

I am looking for a way that would allow me to have a column that I would simply manually input a number and then the list would sort itself based off this list, this would be using c# as the language for the listing and it’s ms SQL

I don’t have much information, but if anyone wants to know anything else feel free to ask and I will try and answer to my best ability.

They are currently stored as strings.

The thing that causes it to get thrown out is because some of the lists contains ranges but some contain fractions, both which are displayed the same I.E 1/2 can mean 1-2 or 1/2(half)

All of the SQL connection is done using NHibernate.

The reason for not simply sorting it normally, is that the list is ordered using fractions currently and the list works fine, however when it gets over 1, it seems to break and throws all of them to the bottom of the list I.E:

Image List

Example of how I would like this to work:

I would have a column in my database named “DisplayOrder” or something along those lines.

Database row says “1”, this would be the first item in a list to appear.
Database row says “8”, this would be the 8th item in the list to appear.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:15:03+00:00Added an answer on June 8, 2026 at 1:15 am

    I’ve put together a quick function to parse your fractions and convert them to floats, which can then be used for comparison and sorting. You may need more in the “sanitation” step, possibly normalizing whitespace, removing other characters, etc., and may have to check the divisor for zero (only you know your data).

    create function dbo.FractionToFloat(@fraction varchar(100))
    returns float
    as
    begin
        declare @input varchar(100)
            , @output float
            , @whole int
            , @dividend int
            , @divisor int
    
        -- Sanitize input
        select @input = ltrim(rtrim(replace(replace(@fraction, '''', ''), '"', '')))
    
        select @whole = cast(case
            when charindex('/', @input) = 0 then @input
            when charindex(' ', @input) = 0 then '0'
            else left(@input, charindex(' ', @input) - 1)
            end as int)
    
        select @dividend = cast(case
            when charindex('/', @input) = 0 then '0'
            when charindex(' ', @input) = 0 then left(@input, charindex('/', @input) - 1)
            else substring(@input, charindex(' ', @input) + 1, charindex('/', @input) - charindex(' ', @input) - 1)
            end as int)
    
        select @divisor = cast(case
            when charindex('/', @input) = 0 then '1'
            else right(@input, charindex('/', reverse(@input)) - 1)
            end as int)
    
        select @output = cast(@whole as float) + (cast(@dividend as float) / cast(@divisor as float))
    
        return @output
    end
    

    This way, you can simply order by the function’s output like so:

    select *
    from MyTable
    order by dbo.FractionToFloat(MyFractionColumn)
    

    I wouldn’t normally suggest rolling your own parser that you have to maintain as the data changes, but this seems simple enough on the surface, and probably better than manually maintaining an ordinal column. Also, if you had to compare various units (feet to inches, minutes to seconds), then this gets more complicated. I’m removing anything that looks like a unit in your demo data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for a way that would allow me to localize some strings
I'm looking for a way to non-destructively alter data. I have one table that
I'm looking for a way that allows me to see the AppStore page in
I am looking for a way that I can do bitwise operations (for crypto
I'm looking for a way that I can keep a database in one single
I am looking for a way to ensure that I always get plain text
I am looking for a way to ensure that my text field (JTextField, JFormattedTextField)
My problem is that I was looking for way to use both storyboard and
I am looking for a way to explain that it's unreasonable to sprinkle high-level
I am looking for a way to create figure that contains several subplots which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.