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

  • SEARCH
  • Home
  • 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 9035349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:44:19+00:00 2026-06-16T08:44:19+00:00

I have a problem in sorting my line numbers. My codes output like this

  • 0

I have a problem in sorting my line numbers.
My codes output like this

(801;802;803;804;805;806;807;808-814(1);808-814(2);815;;;;;;;;;;;;;;;;;840) 

and its delimiter will loop until 840.

Dim sqlline As DataTable = MyDB.ExecCommand("SELECT `Line Number` from `" + cboJob.Text + "` WHERE `Orig Document Begin ID`='" + mData.Rows(z).Item(0).ToString.Trim + "' ORDER BY `Line Number`", "wellsfargo").Tables(0)
                    For q As Integer = 0 To sqlline.Rows.Count - 1
                        If sqlline.Rows.Count <> 0 Then

                            If q = 0 Then
                                lNum = sqlline.Rows(q).Item(0).ToString
                            Else
                                lNum += IIf(dZ.Rows(q).Item(13).ToString <> "", ";" + sqlline.Rows(q).Item(0).ToString, ";")
                            End If
                            'lNum += IIf(sqlline.Rows(q).Item(0).ToString <> "", ";" + sqlline.Rows(q).Item(0).ToString, "")

                        End If
                    Next

But I want my output will be like this.

(801;802;803;804;805;806;807;815;;;;;;;;;;;;;;;;;;;;;840;808-814(1);808-814(2))

so all the line numbers will be at the end.

now.. EDIT
I have this codes for me to put blanks delimiter at the end of the singe line number:

  Dim sCont As String = ""
            If dZ.Rows.Count < 40 Then
                Dim iCont As Integer = 40 - dZ.Rows.Count
                For c As Integer = 0 To iCont - 1
                    If c = 0 Then
                        sCont = ";"
                    Else
                        sCont += ";"
                    End If
                Next
                'Loop then Concatinate strings for each field value.
            ElseIf dZ.Rows.Count = 40 Then
                'Loop as is...
            End If

            Dim sVal As String()
            If dZ.Rows.Count < 40 Then
                sVal = (OrgDocbeg + "■" + _
                                OrgDocend + "■" + _
                                BEGDOC + "■" + _
                                ENDDOC + "■" + _
                                LoanNum + "■" + _
                                PCount + "■" + _
                                Path + "■" + _
                                FNum + "■" + _
                                sDate + "■" + _
                                StrConv(LNF, VbStrConv.ProperCase) + "■" + _
                                lNum + sCont + "■" + _
                                sDesc + sCont + "■" + _
                                StrConv(Amount, VbStrConv.ProperCase).Replace("Poc", "POC").Replace(".00.00", "") + sCont + "■" + _
                                sPay.Replace("^", "").Replace(" Of ", " of ").Replace(" And ", " and ").Replace(" And/or", " and/or").Replace(" By ", " by ").Replace(" 2Nd ", " 2nd ").Replace(" 3Rd ", " 3rd ") + sCont + "■" + _
                                sBorrow.Replace("$.00", "$0.00") + sCont + "■" + _
                                sSell + sCont + "■" + _
                                ProsBor + sCont + "■" + _
                                ProSell + sCont).Split("■")

            Else
                sVal = (OrgDocbeg + "■" + _
                                OrgDocend + "■" + _
                                BEGDOC + "■" + _
                                ENDDOC + "■" + _
                                LoanNum + "■" + _
                                PCount + "■" + _
                                Path + "■" + _
                                FNum + "■" + _
                                sDate + "■" + _
                                StrConv(LNF, VbStrConv.ProperCase) + "■" + _
                                lNum + "■" + _
                                sDesc + "■" + _
                                sPay.Replace("^", "").Replace(" Of ", " of ").Replace(" And ", " and ").Replace(" And/or", " and/or").Replace(" By ", " by ").Replace(" 2Nd ", " 2nd ").Replace(" 3Rd ", " 3rd ") + "■" + _
                                StrConv(Amount, VbStrConv.ProperCase).Replace("Poc", "POC").Replace("$.", "$0.") + "■" + _
                                sBorrow.Replace("$.", "$0.") + "■" + _
                                sSell.Replace("$.", "$0.") + "■" + _
                                ProsBor.Replace("$.", "$0.") + "■" + _
                                ProSell.Replace("$.", "$0.")).Split("■")
            End If

But my output is wrong:

 801;802;803;804;;;;;;;;808 - 817(1);808 - 817(2);808 - 817(3);808 - 817(4);808 - 817(5);808 - 817(6);;;;;;;;;;;;;;;;;;;;;;;

the output should be like this if I have ranges in the line number (must have delimiter until 840)

801;802;803;804;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;808 - 817(1);808 - 817(2);808 - 817(3);808 - 817(4);808 - 817(5);808 - 817(6)

but if I dont have ranges the correct output will be

801;802;803;804
  • 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-16T08:44:20+00:00Added an answer on June 16, 2026 at 8:44 am

    If your line codes have fixed length then you can split resultsets based on the length, sort them independently and then combine them with UNION ALL:

    Dim strQuery = "(SELECT `Line Number` FROM `" + cboJob.Text + _ 
    "` WHERE LOCATE('-', line) = 0 AND `Orig Document Begin ID`='" + mData.Rows(z).Item(0).ToString.Trim + _
    " ORDER BY `Line Number`) " + _ 
    "UNION ALL " + _
    "(SELECT `Line Number` FROM `" + cboJob.Text + _ 
    "` WHERE LOCATE('-', line) > 0 AND `Orig Document Begin ID`='" + mData.Rows(z).Item(0).ToString.Trim + _
    " ORDER BY `Line Number`)"
    
    Dim sqlline As DataTable = MyDB.ExecCommand(strQuery, "wellsfargo").Tables(0)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem sorting vectors in 2D vector? I would like to sort
I have problem with sorting this array: Array ( [0] => stdClass Object (
I have a problem sorting join entities with CoreData. I've made a model like
I have problem with sorting elements by varchar containing Polish characters like ą, Ą.
I have a problem with sorting... I need to sort NSArray containing NSDictionaries .
I have a problem with sorting NSTableColumn contents. In my NSTableView there are three
I have a problem with sorting items in table in PHP. Here is what
I have a complex sorting problem with my SQL statement. I have a table
I have a problem on using LinqToSQL with paging + dynamic sorting. These are
I have problem with my query on C, I’m using the oci8 driver. This

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.