?
Solved

Check values/contents in a view

Posted on 2004-04-11
15
Medium Priority
?
199 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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.
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

801 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