Avatar of amd1979
amd1979 asked on

for madheeswar.

on the last reports that we have created the selection key there is only one that  is  based on the
 date that a certain document was received not cosidering  any field.

now we have to consider other 2 fields such as "The report name" field  and the "Category Type" field

For example i want to select

Report Name  : Nature of Documents Report
Category Type: General Document
Date              : fromDate to ToDate

how can i make a report using this 3 search key?


thanks for your help..







Lotus IBM

Avatar of undefined
Last Comment
madheeswar

8/22/2022 - Mon
madheeswar

next time you should not point my name as other experts will feel bad.

what is report name? is it a field or a view name?
what is category? is it based on a field where u will select the category and we need to display the report?

Pls be in detail what is Report name and what is Category Type?

If I am not wrong, it can be done.
madheeswar

Now I understood ur requirement.
u have view called general Documents\By nature of Documents.
In that view, if the category is XXXX, then in that category, based on from date and to date, need to generate report.

Am I correct?

if the above is correct, then it can be done with small workaround.

the same code which I have given will be reused for this also.

madheeswar

And I will stay another 45 minutes and if you can respond quickly I can provide answer , else wait for tomorrow.

Thanks
Your help has saved me hundreds of hours of internet surfing.
fblack61
RanjeetRain

Mady, I will not feel bad at all if i get some points too ;-)
madheeswar

U have qwaletee Question which is opened till now. And I am not going to share points in this question.
Even amd will be giving more points if I solve this question.

what u will say AMD?

Anyway, Ranjeet how are you. Here I am busy with lots of projects and I am alone now also.
RanjeetRain

Well, I'm ok too. Doing a bit of study. Trying to get some hands on Domino Workflow. Does IBM provide developers' evaluation download?

Good to be busy. How do you handle more than one projects alone? Ask your company to rectruit more people. I may just try my luck too ;-)
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
amd1979

sorry for my late reply, i got disconnected last night.. dont know what happenned to my provider.. any way.. yes you got what iam want to happenned on my search..

"U have qwaletee Question which is opened till now. And I am not going to share points in this question.
Even amd will be giving more points if I solve this question.

what u will say AMD?

I cant understand this..."


tnx



madheeswar

"U have qwaletee Question which is opened till now. And I am not going to share points in this question."
the above is for Ranjeet.

And the below is for u:
Even amd will be giving more points if I solve this question.

what u will say AMD?




ASKER
amd1979

this question is for you and the poist obcourse..

the point is opened until now because i dont how to refund tha point because as far as i know i solve the problem on my own..

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
RanjeetRain

AMD, you can relax. Conversation progressed like this:

>>  Mady, I will not feel bad at all if i get some points too ;-)
>>>>  U have qwaletee Question which is opened till now. And I am not going to share points in this question.
Even amd will be giving more points if I solve this question. (https://www.experts-exchange.com/Applications/Email/Lotus_Notes/Q_20841369.html)

That comment was meant for me. Sorry if that had you confused. Once in a while some "off the track" comments are a common place sight here. Pls ignore them.
ASKER
amd1979

mady,

iam waiting for your answer..

thanks..

amd
madheeswar

If u found the answer for yourself, then close this question.
Just post a thread in commmunity support and retain the points.

if ur still looking for an answer I have to do it.
Best of luck.

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
amd1979

i still need your answer..
madheeswar

create a new field on the form called category_k and make it a dialog list field.
And the formula for that is:
res:=@DbColumn("":"";"";"GNofDoc";1);
@If(@IsError(res);"";res)

And for a new search button the code is:
Sub Click(Source1 As Button)
      
      Dim ws As New notesuiworkspace
      Dim Source As notesuidocument
      Dim curdoc As notesdocument
      
      Set Source=ws.currentdocument
      Set curdoc=Source.document
      
      Dim ss As New notessession
      Dim db As notesdatabase
      Dim view As notesview
      Dim dc As notesdocumentcollection
      Dim doc As notesdocument
      
      Set db=ss.currentdatabase
      
     'tmpkey=curdoc.urDateFieldIntheCurrentdocument(0)
      
      Set view=db.getview("GNofDoc")  'First column should be text and sorted.
      Dim fromdate As NotesDatetime
      Dim todate As notesdatetime
      
      Set fromdate=New notesdatetime(curdoc.Fromdate(0))
      Set todate=New notesdatetime(curdoc.Todate(0))
      
      
     '================================
      Dim xlapp As Variant
      Dim xlsheet As Variant
      
      Set xlapp=createobject("Excel.Application")
      xlapp.statusbar="Creating Worksheet. Please be patient ..."
      xlapp.visible=True
     'xlapp.visible=False
      xlapp.workbooks.add
      xlapp.referencestyle=2
      Set xlsheet=xlapp.workbooks(1).worksheets(1)
      
      
      xlsheet.name="Result"
      
      Dim rows As Integer
      Dim cols As Integer
      Dim maxcols As Integer
      
     'Header Formation;
      xlapp.Rows("1:1").select
      xlapp.selection.font.name="Arial"
      xlapp.selection.font.size=11
      xlapp.selection.font.bold=True
      xlapp.selection.font.italic=True
      
     'Header Information(Titles):
      xlapp.statusbar="Creating Cells and Creating Cell Headings. Please be patient ..."
      xlsheet.application.activesheet.cells(1,1).value="Reference Code"
      xlsheet.application.activesheet.cells(1,2).value="Subject"
      xlsheet.application.activesheet.cells(1,3).value="Sender"
      xlsheet.application.activesheet.cells(1,4).value="Action Requested"
      xlsheet.application.activesheet.cells(1,5).value="COS Remarks"
      xlsheet.application.activesheet.cells(1,6).value="Secretary’s Remarks"
      
      i=2
      
      Set dc=view.getalldocumentsbykey(curdoc.category_k(0),True)
      Set doc=dc.getfirstdocument
      
      While Not doc Is Nothing
            
          'xlapp.visible=True
            Do While fromdate.dateonly<=todate.dateonly
                  tmpkey=Cstr(fromdate.dateonly)
                  
                  Dim checkdate As notesdatetime
                  Set checkdate=New notesdatetime(doc.DTreceive(0))
                  
                  If fromdate.dateonly=checkdate.dateonly Then
                        
                        xlsheet.range("A"&Trim(Str(i))).value=doc.Dtreceive(0)
                        xlsheet.range("B"&Trim(Str(i))).value=doc.Sender(0)
                        xlsheet.range("C"&Trim(Str(i))).value=doc.Subject(0)
                        xlsheet.range("D"&Trim(Str(i))).value=doc.Arequested(0)
                        xlsheet.range("E"&Trim(Str(i))).value=doc.CosRem(0)
                        xlsheet.range("F"&Trim(Str(i))).value=doc.SecRem(0)
                        
                        
                        i=i+1
                        
                        Call xlsheet.Range("A1:F500").Columns.AutoFit
                        Call xlsheet.Range("A1:F500").Rows.AutoFit
                        
                        
                        xlapp.statusbar="Processing ..."
                  End If
                  Call fromdate.Adjustday(1)
            Loop
            Set doc=dc.getnextdocument(doc)
      Wend
      xlapp.statusbar="Completed ..."
      
      
End Sub
ASKER
amd1979

hello mady,

good day..

the code that you provide encountered a little problem..
i think array does not work well..

the data that im on get from the view is only the last document..

example:

Nature of document:              Date:
Document1                           03/25/2004
Document2                           03/25/2004
Document3                           03/25/2004


i only got document 3 on the reports
doc1 and doc2 are not included..

thanks
amd











This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
madheeswar

use the below code for exporting:
Sub Click(Source1 As Button)
      
      Dim ws As New notesuiworkspace
      Dim Source As notesuidocument
      Dim curdoc As notesdocument
      
      Set Source=ws.currentdocument
      Set curdoc=Source.document
      
      Dim ss As New notessession
      Dim db As notesdatabase
      Dim view As notesview
      Dim dc As notesdocumentcollection
      Dim doc As notesdocument
      
      Set db=ss.currentdatabase
      
     'tmpkey=curdoc.urDateFieldIntheCurrentdocument(0)
      
      Set view=db.getview("GNofDoc")  'First column should be text and sorted.
      
      
     '================================
      Dim xlapp As Variant
      Dim xlsheet As Variant
      
      Set xlapp=createobject("Excel.Application")
      xlapp.statusbar="Creating Worksheet. Please be patient ..."
      xlapp.visible=True
     'xlapp.visible=False
      xlapp.workbooks.add
      xlapp.referencestyle=2
      Set xlsheet=xlapp.workbooks(1).worksheets(1)
      
      
      xlsheet.name="Result"
      
      Dim rows As Integer
      Dim cols As Integer
      Dim maxcols As Integer
      
     'Header Formation;
      xlapp.Rows("1:1").select
      xlapp.selection.font.name="Arial"
      xlapp.selection.font.size=11
      xlapp.selection.font.bold=True
      xlapp.selection.font.italic=True
      
     'Header Information(Titles):
      xlapp.statusbar="Creating Cells and Creating Cell Headings. Please be patient ..."
      xlsheet.application.activesheet.cells(1,1).value="Reference Code"
      xlsheet.application.activesheet.cells(1,2).value="Subject"
      xlsheet.application.activesheet.cells(1,3).value="Sender"
      xlsheet.application.activesheet.cells(1,4).value="Action Requested"
      xlsheet.application.activesheet.cells(1,5).value="COS Remarks"
      xlsheet.application.activesheet.cells(1,6).value="Secretary&#8217;s Remarks"
      
      i=2
      
      Set dc=view.getalldocumentsbykey(curdoc.category_k(0),True)
      Set doc=dc.getfirstdocument
      
      While Not doc Is Nothing
            
            Dim fromdate As NotesDatetime
            Dim todate As notesdatetime
            
            Set fromdate=New notesdatetime(curdoc.Fromdate(0))
            Set todate=New notesdatetime(curdoc.Todate(0))
            
            Dim checkdate As notesdatetime
            Set checkdate=New notesdatetime(doc.DTreceive(0))
            
          'xlapp.visible=True
            Do While fromdate.dateonly<=todate.dateonly
                  tmpkey=Cstr(fromdate.dateonly)
                  
                  If fromdate.dateonly=checkdate.dateonly Then
                        
                        xlsheet.range("A"&Trim(Str(i))).value=doc.Dtreceive(0)
                        xlsheet.range("B"&Trim(Str(i))).value=doc.Sender(0)
                        xlsheet.range("C"&Trim(Str(i))).value=doc.Subject(0)
                        xlsheet.range("D"&Trim(Str(i))).value=doc.Arequested(0)
                        xlsheet.range("E"&Trim(Str(i))).value=doc.CosRem(0)
                        xlsheet.range("F"&Trim(Str(i))).value=doc.SecRem(0)
                        
                        
                        i=i+1
                        
                        Call xlsheet.Range("A1:F500").Columns.AutoFit
                        Call xlsheet.Range("A1:F500").Rows.AutoFit
                        
                        
                        xlapp.statusbar="Processing ..."
                  End If
                  Call fromdate.Adjustday(1)
            Loop
            Set doc=dc.getnextdocument(doc)
      Wend
      xlapp.statusbar="Completed ..."
      
      
End Sub
ASKER CERTIFIED SOLUTION
madheeswar

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
amd1979

no i didnt know that you sent me an email, ill check it first, ill back to later. thanks..
ASKER
amd1979

is there any website that i can visit where i can get some code on how to format the excel cell using lotus script

thanks
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
madheeswar

notes.net

codestore.net

searchdomino.com

etc.,...
Arunkumar

Well, you guys are rocking here without me Huh ?  Give me some points and i will be participating too !

:-)
Long since i am here @EE...
ASKER
amd1979

thanks for the support mady...
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
madheeswar

You are welcome.

Arun,
Don't get disappointed. You have to spend a little bit of time in EE and you will achieve your position back.