How to use FindPattern of NewTopicFinder

  • 1
  • Question
  • Updated 3 years ago
I need to write a c# code to search some topics with conditions such as startdate=XXX.
When I am using FindPattern  of the NewTopicFinder object , I don't know how to fill the FindPattern. For example, "StartDate=2015/7/6" is right?
Could anyone tell me how to use FindPattern of NewTopicFinder? Thanks!
Photo of zhou jimmy

zhou jimmy

  • 9 Posts
  • 0 Reply Likes

Posted 3 years ago

  • 1
Photo of Nick Duffill

Nick Duffill, Champion

  • 505 Posts
  • 168 Reply Likes
Hello

I think the FindPattern is just some text to search for in the Topic.Text property. I could not find any documentation about the FindMask. Maybe it can search other fields, but it is not a typed property so there are no clues from Intellisense. If you need to match on dates, then you may need some extra code in the Iterator.TopicFound event.

Some sample MMScript code that finds topics with the word "establish" in the topic text:

'#Language "WWB-COM"
Option Explicit

Dim WithEvents iterator As TopicFinder
Sub Main
    Debug.Clear
      Dim t As Topic
    Set t = ActiveDocument.CentralTopic
      Set iterator = t.NewTopicFinder
      iterator.IncludeTopicTypes = mmIteratorIncludeTopicFlagCallout + mmIteratorIncludeTopicFlagFloating
    iterator.CriteriaMask = mmIteratorCriteriaFlagHasNotes + mmIteratorCriteriaFlagHasIcon
    iterator.PassCriteria = mmIteratorPassCriteriaAny
    iterator.IncludeHiddenTopics = False
    iterator.FindPattern = "establish"
    iterator.Start
End Sub

Private Sub iterator_TopicFound( t As Topic )
    Debug.Print t.Text
End Sub
Photo of zhou jimmy

zhou jimmy

  • 9 Posts
  • 0 Reply Likes
Thanks a lot! I think your sample is very useful. Now I can search out the topics I want in a short time.
Photo of Nigel Goult (Olympic & MIVAP)

Nigel Goult (Olympic & MIVAP)

  • 344 Posts
  • 133 Reply Likes
Jimmy,

I use the TopicFinder method to simply find all the topics and then carry out any further checks in the TopicFound event as Nick describes above.

This is better than using a For/Next loop on a topic range because it runs clockwise around the Map Topics so is good for exporting when you want Topics processed in sequence. It is also faster.

Regards
Nigel

MAP for MindManager - more than 30 new functions taking MindManager to the next level. A must have for all Windows MindManager users. Now with extended license plans for Enterprise and Education - Learn more at www.mapformindmanager.com