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 9097965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:14:57+00:00 2026-06-17T00:14:57+00:00

So I have to save from a grid where there are two types of

  • 0

So I have to save from a grid where there are two types of IDs. LineId & CustId. There can be multiple CustIds for each LineId. An example of data would be like this:

LineId     CustId
1          33
2          98
7          101
1          51
3          28
7          02
1          35        

I need to save the code with a save procedure that accepts a null-delimited string of CustIds for each Line id. I call the save procedure once for each LineId being saved. I cannot change how the save procedure works.

So far I have been adding the grids to a type array with line id and cust id.

Dim typeRows(gridRows - 1) As Ids 'gridRows is rowcount of grid
For i = 0 To grid.Rows - 1
    typeRows(i).LineId = grid.TextMatrix(i, GridColumns.colLineId)
    typeRows(i).CustId = grid.TextMatrix(i, GridColumns.colCustId)
Next

But I’m a little stuck on what I should do next. Should I sort the grid? Then how would I go through the sorted grid and combine cust ids for each lineid?

Any help or guidance would be very appreciated.

  • 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-17T00:14:58+00:00Added an answer on June 17, 2026 at 12:14 am

    without sorting the grid you have to loop through the array as well to check if the id was already found before, that can be done as well, but might take some time depending on the size of your data

    '1 form with :
    '    1 flexgrid control : name=grid
    Option Explicit
    
    Private Type Ids
      LineId As String
      CustId As String
    End Type
    
    Private Sub Form_Click()
      'export to delimited string
      Dim intRow As Integer
      Dim intId As Integer
      Dim intBound As Integer
      Dim udtIds() As Ids
      Dim blnThere As Boolean
      Dim intCount As Integer
      With grid
        intBound = .Rows - 1
        ReDim udtIds(intBound) As Ids
        intCount = 0
        For intRow = 1 To intBound
          'loop through all rows
          blnThere = False
          For intId = 0 To intBound
            'check if lineid was already found before
            If udtIds(intId).LineId = .TextMatrix(intRow, 0) Then
              blnThere = True
              Exit For
            End If
          Next intId
          If blnThere Then
            'if lineid was already found before, just add the custid
            udtIds(intId).CustId = udtIds(intId).CustId & "," & .TextMatrix(intRow, 1)
          Else
            'if lineid is new, then create new lineid with custid in udt
            udtIds(intCount).LineId = .TextMatrix(intRow, 0)
            udtIds(intCount).CustId = .TextMatrix(intRow, 1)
            intCount = intCount + 1
          End If
        Next intRow
      End With 'grid
      'now you can save the udt
    End Sub
    
    Private Sub Form_Load()
      With grid
        'fill grid with example values
        .Cols = 2
        .Rows = 8
        .FixedRows = 1
        .FixedCols = 0
        .TextMatrix(0, 0) = "LineId"
        .TextMatrix(0, 1) = "CustId"
        .TextMatrix(1, 0) = "1"
        .TextMatrix(2, 0) = "2"
        .TextMatrix(3, 0) = "7"
        .TextMatrix(4, 0) = "1"
        .TextMatrix(5, 0) = "3"
        .TextMatrix(6, 0) = "7"
        .TextMatrix(7, 0) = "1"
        .TextMatrix(1, 1) = "33"
        .TextMatrix(2, 1) = "98"
        .TextMatrix(3, 1) = "101"
        .TextMatrix(4, 1) = "51"
        .TextMatrix(5, 1) = "28"
        .TextMatrix(6, 1) = "02"
        .TextMatrix(7, 1) = "35"
      End With 'grid
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a grid bound from a mysql db table via c#. Is there
I'm writing a bat script and I have to save the date from a
i have created one image but problem is that when i save image from
I have a UITableView that lists comments from various users. I save all of
How to save ByteArray to HardDrive from Flash swf? So... I have a generated
suddenly we have to save kanji (Japanese) in a couple of columns of two
I have a form bound to a grid where a user can either create
Hi I have following XAML code which is the output from XamlWriter.Save(): <StackPanel Name=itemStack
I have a form with few tabs, and in each tab an grid control.
I have a save as image feature for charts in my application. The chart

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.