PDA

View Full Version : asp and dynamic wap


rm0526
06-06-2003, 02:09 PM
i am writng this code to read through our lotus notes database and search for a client name. then once the client name has been found print it n the phone screen. the problem lied when wap only alows a certain number of bytes per screen. so i tried to count the bytes as im going through the list print until the byte hits max then if the user clicks "more" pass back a vairable and the client name and start a new screen and contnue printing the list from where i left off. it seems to be working with the first part of the list but when clicking more it repeats the same list for some clients and returns nothing for other clients and works fine with other clients. in desperate need of help. thanks


<%
dim s
dim db
dim view
dim doccol
dim doc
dim var1
dim var2
dim var3
dim newline
dim x
dim k
dim y
dim i

newline = "<br/>"
var3 = Request.QueryString("Callclient")
x = Request.QueryString("ViewLineNum")
k = cint(x)

Set s = CreateObject("Lotus.NotesSession")
Call s.Initialize
set db=s.getdatabase("NYDOMAPPS01", "Support.nsf")
set view = db.getview ("1. Clients\By Name")
set doccol=view.GetALLDocumentsByKey (var3)
set doc = view.getFirstDocument
%>

<card id = "print">
<p >
<b>CALL'S by CLIENT</b>
<% Response.Write newline
dim ClientOriginalName1
dim clientID1
dim currentBytePos
currentBytePos = 300
dim maxByte
maxByte = 1000
dim count1


do until (k > view.toplevelentrycount or currentBytePos > maxByte)


if Instr(ucase(doc.getItemValue("ClientName")(0)), ucase(var3)) > 0 then

ClientOriginalName1 = doc.getitemValue("ClientName")(0)
clientID1 = doc.getItemValue("ClientID")(0)
currentBytePos = currentBytePos + LenB(ClientOriginalName1)
'print-----------------------------------
response.Write "<a href=""CallByClient.asp?clientid=" & clientID1 & """>"

response.write Replace( Replace(ClientOriginalName1, "&", "&amp;") ,"'","&apos;")
response.write "</a>"

response.Write newline
End if

set doc = view.GetNextDocument(doc)
k = k +1
loop

if cint(currentBytePos) > cint(maxbyte) then
x=cstr(k)
response.write "<a href=""note.asp?Callclient=" & var3 & "&amp;ViewLineNum=" & x & """>MORE</a>"

end if %>



</p>
</card>
</wml>