Solved

Check values/contents in a view

Posted on 2004-04-11
15
189 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
Comment Utility
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
Comment Utility
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
Comment Utility
I tried both formulas but still it brings me to the DT form eventhough there is no document in the view ..HELP!!!!
0
 

Author Comment

by:emem
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 14

Expert Comment

by:p_partha
Comment Utility
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
Comment Utility
What if multiple documents are selected?
0
 
LVL 24

Expert Comment

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

Expert Comment

by:p_partha
Comment Utility
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
Comment Utility
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
Comment Utility
nice arguement...but can't we change prompt msgs ;-)
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
Hemantha,

Interesting question, but for how many points?

Sjef ;)

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

Author Comment

by:emem
Comment Utility
thanks for all the inputs the formula that madheeswar worked! thanks
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
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.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now