Solved

Check values/contents in a view

Posted on 2004-04-11
15
194 Views
Last Modified: 2013-12-18
How would I check for documents inside a view...my scenario is like this ...when I click the Create Details button and I dont have documents in the view a messagebox will appears stating that "No documents/No document selected".  If there are documents in the view and I selected one and click on the Create details button it will proceed to the form below is the formula I created but still I goes to the form eventhough there is no document selected in the view ....

view:= "ACT";
result:=@If (@Trim(@DbColumn("": "NoCache" ; "" : "" ; view ; 1)=" ");0;1);
@If(result=0);@Command([Compose];"DT");
@If(result=1);@Prompt([OK];"Warning";"No document/No documents selected.")
0
Comment
Question by:emem
  • 4
  • 3
  • 3
  • +2
15 Comments
 
LVL 19

Expert Comment

by:madheeswar
ID: 10803816
Change it to:

view:= "ACT";
result:=@If (@Trim(@DbColumn("": "NoCache" ; "" : "" ; view ; 1))=" ";0;1);
@If(result=0;@Command([Compose];"DT");
@Prompt([OK];"Warning";"No document/No documents selected."))
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 10803824
or else try this:

view:= "ACT";
res:=@DbColumn("": "NoCache" ; "" : "" ; view ; 1);
result:=@If (@IsError(res);"";@if(res="";0;1));
@If(result=0;@Command([Compose];"DT");
@Prompt([OK];"Warning";"No document/No documents selected."))
0
 

Author Comment

by:emem
ID: 10803911
I tried both formulas but still it brings me to the DT form eventhough there is no document in the view ..HELP!!!!
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

Author Comment

by:emem
ID: 10803919
wait i just changed 0 to 1 it seems to work i'll test it thoroughly first I 'll get back
0
 
LVL 19

Accepted Solution

by:
madheeswar earned 100 total points
ID: 10803932
Try the below code:

view:= "ACT";
res:=@DbColumn("": "NoCache" ; "" : "" ;view ; 1);
result:=@If (@IsError(res);"";@if(res="";"Y";"N"));
@If(result="N";@Command([Compose];"mainform");@Prompt([OK];"Warning";"No document/No documents selected.")) ;
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10804149
Checking if there are Selected documents only works (satisfactorily) from LotusScript, using an agent or action in a view and checking the UnprocessedDocuments property of the NotesDatabase. See the document in the NotesHelp, open the Index, look for UnprocessedDocuments property.

In a view action, do something like this:

    Dim ns As New NotesSession
    Dim db As NotesDatabase
    Dim dc As NotesDocumentCollection
    Dim ws As New NotesUIWorkspace

    Set db= ns.CurrentDatabase
    Set dc= db.UnprocessedDocument
    If dc.count=0 Then
        MsgBox "No document/No documents selected."
        Exit Sub
    End If
    Call ws.ComposeDocument("","","DT")        

Eh, beware of typo's...

Sjef
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10805126
I hope this action button is to be on the view ACT ?? Right ..

If so replace your formula to this

@IF( Form != ""; @Command([Compose];"DT"); @Prompt([OK];"Warning";"No document/No documents selected.") )

Essentially I am checking for a field (say form) in the selected document if that doesn't exist it would be null and prompt the error

~Hemanth
0
 
LVL 14

Expert Comment

by:p_partha
ID: 10805418
Hemanth's answer is wonderful !!!. It will work, if u choose a categorized column and click on "Create Details Button", but in your case you don't want to compose the details document when the view is empty, so try something like this:

view:= "ACT";
result:=@If (@elements(@DbColumn("": "NoCache" ; "" : "" ; view ; 1))=0;1;0);
@If(result=0;@Command([Compose];"DT");
@Prompt([OK];"Warning";"No document/No documents selected."))

Let me know whether it works !

Partha
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10805809
What if multiple documents are selected?
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10805943
It will pick up the highlighted document ;-).. not the selection
0
 
LVL 14

Expert Comment

by:p_partha
ID: 10806055
I believe his logic demands only one document to be selected (as i presume that he might pick up the info from the selected document and do some stuff !)

Partha
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10806601
Then why the errormessage
    @Prompt([OK];"Warning";"No document/No documents selected."))

This suggests that there will be functionality with multiple selected documents. Don't it?
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10806673
nice arguement...but can't we change prompt msgs ;-)
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10807770
Hemantha,

Interesting question, but for how many points?

Sjef ;)

PS QuickPost won't Submit any longer...
0
 

Author Comment

by:emem
ID: 10810011
thanks for all the inputs the formula that madheeswar worked! thanks
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Lotus Notes 8.5 1 154
Disable Return Receipt In Lotus Notes 15 335
IBM Domino web server 5 69
See used databases in Domino 8 104
This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question