3 Replies - 847 Views - Last Post: 02 June 2014 - 10:54 AM Rate Topic: -----

#1 jrb47   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 21-April 07

adding pagination or 'next' buttong to code

Posted 02 June 2014 - 09:12 AM

I have been able to limit the number of data to send to the application however I need help setting up the application to show the fetch next button.

data retrieval code - I am using show only 2 rows because I have a small amount of data in the test database

 <WebMethod(Description:="Retrieve members of a Client List"), SoapHeader("MessageSoapHeader", direction:=SoapHeaderDirection.In)> _
Public Function GetClientListMembers() As DataSet
    Dim RS As SqlDataReader

    RS = objApp.ConnectUser(MessageSoapHeader.UID, MessageSoapHeader.PWD, MessageSoapHeader.Campaign, MessageSoapHeader.Keyword, LocalCommon.apSOAPAdvanced)
    RS.Close()
    If objApp.ClassErrorsCount > 0 Then
        objApp.DB.Close()
        Dim NX As New Exception
        LLIB.ThrowSOAPException(objApp.Errors(1).Number, NX, objApp.DB, objApp.Errors(1).ErrorType, objApp.Errors(1).Description)
        GetClientListMembers = New DataSet
        Exit Function
    End If
    LLIB.FunctionCount(objApp, "GetClientListMembers") 'This must be placed after the close of RS

    GetClientListMembers = LLIB.GetDataSet("SELECT CellNumber,Carrier,Keyword, dbo.fn_ToUTC(ActualOptInDate) AS ActualOptInDate FROM Optins WHERE ShortCode='" & objApp.ShortCode & "' AND Keyword='" & objApp.Keyword & "' AND OptInState=2 ORDER BY CellNumber ASC Offset 2 ROWS FETCH NEXT 2 ROWS ONLY", objApp)
    GetClientListMembers.Tables(0).TableName = "Cell Numbers"
    LLIB.RecordRowTransfer(GetClientListMembers.Tables(0).Rows.Count, LLIB.RowTransferDirection.ToClient, objApp)
    'Now get the email stuff
    LLIB.AddDataTable(GetClientListMembers, "Email Addresses", "SELECT EmailAddress,Keyword, dbo.fn_ToUTC(ActualOptInDate) AS ActualOptInDate FROM EmailOptins WHERE ShortCode='" & objApp.ShortCode & "' AND Keyword='" & objApp.Keyword & "' AND OptInState=2 ORDER BY EmailAddress", objApp)

    If GetClientListMembers.Tables.Count > 1 Then LLIB.RecordRowTransfer(GetClientListMembers.Tables(1).Rows.Count, LLIB.RowTransferDirection.ToClient, objApp)

    objApp.DB.Close()
End Function


The user view (where I need to add the 'next' link is

 Private Sub DisplayDS(ByRef ThisDS As DataSet, ByVal tblNumber As Integer)
    Dim i As Integer
    Me.txtDisplay.Text = ThisDS.ToString
    Me.comboDSTables.Items.Clear()
    For i = 0 To ThisDS.Tables.Count - 1
        Me.comboDSTables.Items.Add(i.ToString & "_" & ThisDS.Tables(i).TableName)
    Next
    Me.comboDSTables.SelectedIndex = tblNumber
    Me.lblNumberOfTables.Text = ThisDS.Tables.Count
    Dim myBindingSource As BindingSource = New BindingSource
    myBindingSource.DataSource = ThisDS.Tables(tblNumber)
    Me.AdvDataGrid.DataSource = myBindingSource
End Sub


The 'click' or button code is
    'Private Sub cmdDeleteSLMembersDifferential_Click(sender As Object, e As EventArgs) Handles cmdDeleteSLMembersDifferential.Click
'    Dim xmlNodeResult As Xml.XmlNode
'    LoadHeader()
'    Try
'        xmlNodeResult = AdvServer.DeleteSendListMembersDifferential(Me.txtListName.Text, TestDB())
'    Catch SoapEx As Exception
'        MsgBox(SoapEx.Message)
'        Exit Sub
'    End Try
'    Me.txtDisplay.Text = xmlNodeResult.OuterXml
'End Sub

Private Sub cmdSendToList_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdSendToList.Click
    Dim xmlNodeResult As Xml.XmlNode, ThisTime As Date
    LoadHeader()
    If Me.chkDelay.Checked Then
        If IsDate(Me.txtDelayTime.Text) Then
            ThisTime = CDate(Me.txtDelayTime.Text)
            ThisTime = ThisTime.ToUniversalTime 'Input is in local time.
        Else
            MsgBox("Delay set but Delay Time is not a date")
            Exit Sub
        End If
    Else
        ThisTime = Now()
    End If
    Try
        xmlNodeResult = AdvServer.SendToSendList(Me.txtListName.Text, Me.txtMsg.Text, Me.chkDelay.Checked, ThisTime)
    Catch SoapEx As Exception
        MsgBox(SoapEx.Message)
        Exit Sub
    End Try
    Me.txtDisplay.Text = xmlNodeResult.OuterXml
End Sub



ANY help is much appreciated - I have been working on this for about a week and it is escaping me!

Thank you!

Is This A Good Question/Topic? 0
  • +

Replies To: adding pagination or 'next' buttong to code

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14248
  • View blog
  • Posts: 57,169
  • Joined: 12-June 08

Re: adding pagination or 'next' buttong to code

Posted 02 June 2014 - 09:41 AM

Break down what needs to happen to do pagination.

1. You need a consistent ordering. Be it a row id, name, or what ever.
2. You need to know how to pull back X rows... so limiting on the query.
3. You need to logically figure out the four following: first, previous, next, last.
3.b - all those four really need to be are boolean values to trigger some visual on the app.
3.c - the app needs to recognize triggers (buttons or link labels, or what ever) and logically pull the right query together.


It would be best if you wrote it out by hand.. draw it out on some paper..

'first' is true if the current id to first id have a counter greater than zero.
'previous' is the same.
'next' is if the last id of the set to the last id have a count greater than zero
'last' is the same.
Was This Post Helpful? 0
  • +
  • -

#3 jrb47   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 21-April 07

Re: adding pagination or 'next' buttong to code

Posted 02 June 2014 - 10:34 AM



Here is what I have and what I need help with:

1. You need a consistent ordering. Be it a row id, name, or what ever.
This is done with the following query : with the cellNumber being the ID

SELECT CellNumber,Carrier,Keyword, dbo.fn_ToUTC(ActualOptInDate) AS ActualOptInDate,* FROM Optins WHERE ShortCode='" & objApp.ShortCode & "' AND Keyword='" & objApp.Keyword & "' AND OptInState=2 ORDER BY CellNumber ASC Offset 100 ROWS FETCH NEXT 100 ROWS ONLY" 


2. You need to know how to pull back X rows... so limiting on the query.

I thought that the fetch next portion of the query would do that

3. You need to logically figure out the four following: first, previous, next, last.
first would be min(cellphone) previous would be between..... I can get the queries for these


b and c I need help with as I have not done this in visual basic - even if there was some code samples and a direction as to WHERE to put the code needed.

3.b - all those four really need to be are boolean values to trigger some visual on the app.


3.c - the app needs to recognize triggers (buttons or link labels, or what ever) and logically pull the right query together.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14248
  • View blog
  • Posts: 57,169
  • Joined: 12-June 08

Re: adding pagination or 'next' buttong to code

Posted 02 June 2014 - 10:54 AM

I am not sure what to make of that last post.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1