Link to home
Start Free TrialLog in
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..







Avatar of madheeswar
madheeswar
Flag of Singapore image

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.
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.

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

Thanks
Avatar of RanjeetRain
RanjeetRain

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.

what u will say AMD?

Anyway, Ranjeet how are you. Here I am busy with lots of projects and I am alone now also.
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 ;-)
Avatar of amd1979

ASKER

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



"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?




Avatar of amd1979

ASKER

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..

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/questions/20841369/Ranjeet-what's-the-most-interesting-bit-of-code-you-have-developed-lately.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.
Avatar of amd1979

ASKER

mady,

iam waiting for your answer..

thanks..

amd
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.

Avatar of amd1979

ASKER

i still need your answer..
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
Avatar of amd1979

ASKER

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











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
Avatar of madheeswar
madheeswar
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of amd1979

ASKER

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

ASKER

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
notes.net

codestore.net

searchdomino.com

etc.,...
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...
Avatar of amd1979

ASKER

thanks for the support mady...
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.