cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Macro to mine text on an objects "Comments" field

Scriv1989
Super Contributor

Hi All,

 

I am trying to write a macro that extracts the text from an objects "Comments" field (i.e the text that is entered on an objects comments by someone creating content) and then tells me if an Org-Unit object name is within that text.

 

For example lets say I have an Org-Unit object called "Contractor" and I have another Business Process Object called "Assurance". I want my macro to look at the "Comments" field of the Business Process Object "Assurance" and check to see if the word "Contractor" appears in that field or not.

 

I'm wondering if anyone could share a macro that does something similar to give me something to start with as macros are not something I am used to dealing with.

 

Many thanks!

Aaron

5 Replies

ki6i
Trusted Contributor

The only thing that comes up in my mind is

 

dim application
set applications = getRoot().getCollection("Application")
for each application in applications 
  if(InStr(application.getProp("comment"), "~FgQEydJ2LziI") ) then 
    print application.getProp("comment")
  end if
Next

 

That is what you get:

{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}}
\viewkind4\uc1\pard\lang2057\fs20 Test of system purpose \v ~FgQEydJ2LziI[\b\v0 Application-53\b0\v ]\v0 ssw\par
}

Elapsed Time : 0.849 s

Bump

Scriv1989
Super Contributor

Thanks Jerome,

 

I am afraid the first solution, although works will not do exactly what I need it to do. In short I will be generating a document where an "Org-Unit"'s name is described in the comments box of another object but will need the value of the org unit name to change according to what org unit you are looking at. I therefore need to store the org unit name in a variable of some sort to run the check. Are you aware of a similar solution that might exist for this?

 

Kind Regards,

Aaron

jhorber
MEGA
MEGA

Note also that with in solutions (ERM, Audit, ITPM, Internal Control..) of HOPEX Web Front-End, a full search feature is available

It is not available in Windows Front-end.

Jerome

jhorber
MEGA
MEGA

Hello Arron

 

1) Note that there is a standard feature to search for a string within the text 'Comment' of all Metaclass'

See image atached

 

ScreenShot001.jpg

 

2) Another option is to use an element of the syntax of ERQL queries

Ex:

Select [Org-Unit] Where Comment Like "#contractor#" 

By code you can build a query for each MetaClass

 

3) Another option is to use macro code to parse the text values of all to object.

See VB Script language capabilities.

 

In all case, note that such features will be time consuming.

Jerome