Solved

Check values/contents in a view

Posted on 2004-04-11
15
190 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Validating Email Address 13 283
Synchronize IBM notes Internet Password with AD 9 362
Adding a named anchor in a Lotus Notes Form 6 83
Counting documents in a Domino View 3 59
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…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

943 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

15 Experts available now in Live!

Get 1:1 Help Now