Skip to main content
BlueMix free trial
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks

  

Sign in to participate PreviousPrevious NextNext

SOLUTION: Check if an attachment is in a richtextfield using @Formula
Kevin Pettitt 20.Oct.14 02:50 PM a Web browser
Applications Development 7.0.1 Windows XP


As others have said this is not possible w/ @Formula but is with Lotusscript. Here's how I did it:

In the QuerySave event:

Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim thisDoc as NotesDocument
Dim rtitem As NotesRichTextItem

Set thisDoc = Source.Document
Set rtitem = thisDoc.GetFirstItem( "rtf_FieldName") '<<Put in your field name here
Call rtitem.Update
Call uidoc.Refresh(True)
If Isempty(rtitem.EmbeddedObjects) = False Then
'Check if the associated markup field has any attachments and set a flag field for use in hide when formulas later
Call thisDoc.ReplaceItemValue("txt_HasAttachmentFlagField", "Yes")
Else
Call thisDoc.ReplaceItemValue("txt_HasAttachmentFlagField", "No")
End If

End Sub

If you need to use this in multiple cases, you can move all this code to its own function, where you pass the names of the rtf and the flag field as string parameters, like this:

Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim thisDoc as NotesDocument
Set thisDoc = Source.Document

If CheckForAttachment(thisDoc, "rtf_FieldName", "txt_HasAttachmentFlagField") = False then
Print "Error checking for attachment"
End If
End Sub

Function CheckForAttachment(thisDoc as NotesDocument, rtfFieldName as String, HasAttachmentFlagFieldName as string) as Boolean
On Error Goto ErrorHandler
CheckForAttachment = False
Dim rtitem As NotesRichTextItem

Set rtitem = thisDoc.GetFirstItem( rtfFieldName )
Call rtitem.Update
Call uidoc.Refresh(True)
If Isempty(rtitem.EmbeddedObjects) = False Then
'Check if the associated markup field has any attachments and set a flag field for use in hide when formulas later
Call thisDoc.ReplaceItemValue(HasAttachmentFlagFieldName , "Yes")
Else
Call thisDoc.ReplaceItemValue(HasAttachmentFlagFieldName , "No")
End If

CheckForAttachment = True

Exit Function

ErrorHandler:
Print "Add your error handling logging code here"
Exit Function

End Function




Check if an attachment is in a rich... (Harry Bellafont... 25.Mar.10)
. . RE: Check if an attachment is in a ... (Paul K Smerdon 25.Mar.10)
. . . . RE: Check if an attachment is in a ... (Harry Bellafont... 26.Mar.10)
. . . . . . RE: Check if an attachment is in a ... (Andre Guirard 26.Mar.10)
. . . . . . RE: Check if an attachment is in a ... (Stan Rogers 26.Mar.10)
. . . . . . . . RE: Check if an attachment is in a ... (Harry Bellafont... 26.Mar.10)
. . . . . . . . . . RE: Check if an attachment is in a ... (Andre Guirard 26.Mar.10)
. . SOLUTION: Check if an attachment is... (Kevin Pettitt 20.Oct.14)


Document Options






  Document options
Print this pagePrint this page

Search this forum

Forum views and search


  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

Sign In or Register

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

Resources

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds

Wikis

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums


 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite