filtering on OLE

Hi,

is it possible create a filter like :
i want see only Objects with OLE inside.
Pierre
PDU - Fri Mar 02 03:30:20 EST 2012

Re: filtering on OLE
Peter_Albert - Fri Mar 02 04:10:20 EST 2012

Not with the standard filter, but with DXL. The below script uses oleCount(o."Object Text") to identify whether an "Object Text" contains an OLE object, and then accept and reject to apply the filtering. Caveat: The filter cannot be stored with a View.

Regards,

Peter
 

// OLE
/*
Find OLE Objects
*/
void filterOLE(DB db, bool showOLEObjects)
{
  filtering off
  Object o
  int nos = 0
  int NOleObjects = 0
  int NOleElements = 0
  int n
  string h
  for o in current Module do nos++
  int nSave = nos
  progressStart(db, "Filtering OLE objects", name(current Module),nos)
  nos = 0
  for o in current Module do
  {
    progressStep ++nos
    h = "Object #: " nos " [" nSave "]"
    progressMessage h 
    if (progressCancelled){if (confirm("Exit loop?")){progressStop; halt}}
    n = oleCount(o."Object Text")
    if (!null(n))
      {(showOLEObjects)?(accept o):(reject o); NOleObjects++; NOleElements = NOleElements + n}
    else {(showOLEObjects)?(reject o):(accept o)}
  }
  filtering on
  refresh current
  progressStop
  infoBox(
    db, 
    NOleObjects " Objects out of " nSave " contain OLE elements.\n"//-
    NOleElements " OLE elements in total."
    )
  hide db
}
void showOLE(DB db){filterOLE(db, true)}
void hideOLE(DB db){filterOLE(db, false)}
DB oleDB = create("", styleCentered)
apply(oleDB, "Show OLE objects", showOLE)
apply(oleDB, "Hide OLE objects", hideOLE)
show oleDB

Re: filtering on OLE
PDU - Fri Mar 02 04:21:10 EST 2012

Peter_Albert - Fri Mar 02 04:10:20 EST 2012

Not with the standard filter, but with DXL. The below script uses oleCount(o."Object Text") to identify whether an "Object Text" contains an OLE object, and then accept and reject to apply the filtering. Caveat: The filter cannot be stored with a View.

Regards,

Peter
 

// OLE
/*
Find OLE Objects
*/
void filterOLE(DB db, bool showOLEObjects)
{
  filtering off
  Object o
  int nos = 0
  int NOleObjects = 0
  int NOleElements = 0
  int n
  string h
  for o in current Module do nos++
  int nSave = nos
  progressStart(db, "Filtering OLE objects", name(current Module),nos)
  nos = 0
  for o in current Module do
  {
    progressStep ++nos
    h = "Object #: " nos " [" nSave "]"
    progressMessage h 
    if (progressCancelled){if (confirm("Exit loop?")){progressStop; halt}}
    n = oleCount(o."Object Text")
    if (!null(n))
      {(showOLEObjects)?(accept o):(reject o); NOleObjects++; NOleElements = NOleElements + n}
    else {(showOLEObjects)?(reject o):(accept o)}
  }
  filtering on
  refresh current
  progressStop
  infoBox(
    db, 
    NOleObjects " Objects out of " nSave " contain OLE elements.\n"//-
    NOleElements " OLE elements in total."
    )
  hide db
}
void showOLE(DB db){filterOLE(db, true)}
void hideOLE(DB db){filterOLE(db, false)}
DB oleDB = create("", styleCentered)
apply(oleDB, "Show OLE objects", showOLE)
apply(oleDB, "Hide OLE objects", hideOLE)
show oleDB

thanks very much

Re: filtering on OLE
SystemAdmin - Fri Mar 02 07:29:36 EST 2012

PDU - Fri Mar 02 04:21:10 EST 2012
thanks very much

Module m = current

Object o

for o in m do
{
if(oleIsObject o)
{
accept o
}
else
{
reject o
}
}

filtering on

Re: filtering on OLE
SystemAdmin - Fri Mar 02 07:32:41 EST 2012

SystemAdmin - Fri Mar 02 07:29:36 EST 2012
Module m = current

Object o

for o in m do
{
if(oleIsObject o)
{
accept o
}
else
{
reject o
}
}

filtering on

Module m = current
 
Object o
 
for o in m do
{
    if(oleIsObject o)
    {
        accept o
    }
    else
    {
        reject o
    }
}
 
filtering on

Re: filtering on OLE
DiBob - Wed Apr 09 03:34:50 EDT 2014

Peter_Albert - Fri Mar 02 04:10:20 EST 2012

Not with the standard filter, but with DXL. The below script uses oleCount(o."Object Text") to identify whether an "Object Text" contains an OLE object, and then accept and reject to apply the filtering. Caveat: The filter cannot be stored with a View.

Regards,

Peter
 

// OLE
/*
Find OLE Objects
*/
void filterOLE(DB db, bool showOLEObjects)
{
  filtering off
  Object o
  int nos = 0
  int NOleObjects = 0
  int NOleElements = 0
  int n
  string h
  for o in current Module do nos++
  int nSave = nos
  progressStart(db, "Filtering OLE objects", name(current Module),nos)
  nos = 0
  for o in current Module do
  {
    progressStep ++nos
    h = "Object #: " nos " [" nSave "]"
    progressMessage h 
    if (progressCancelled){if (confirm("Exit loop?")){progressStop; halt}}
    n = oleCount(o."Object Text")
    if (!null(n))
      {(showOLEObjects)?(accept o):(reject o); NOleObjects++; NOleElements = NOleElements + n}
    else {(showOLEObjects)?(reject o):(accept o)}
  }
  filtering on
  refresh current
  progressStop
  infoBox(
    db, 
    NOleObjects " Objects out of " nSave " contain OLE elements.\n"//-
    NOleElements " OLE elements in total."
    )
  hide db
}
void showOLE(DB db){filterOLE(db, true)}
void hideOLE(DB db){filterOLE(db, false)}
DB oleDB = create("", styleCentered)
apply(oleDB, "Show OLE objects", showOLE)
apply(oleDB, "Hide OLE objects", hideOLE)
show oleDB

Thank you Peter, your script is working very well.

Re: filtering on OLE
llandale - Thu Apr 10 14:57:02 EDT 2014

yes, the above accept/reject filtering will work.

But if you want to save the filter in a view, you'd need something like this:

  • Create a boolean Attr-DXL: if (oleIsObject(obj)) then obj.AttrDXLName = true else obj.attrDXLName = false
  • Filter on that attribute

..err.. if there is an OLE in the Object Text.  If you want to find all objects with ANY OLE in any Text attribute, you'd need to poll all such attributes:

  • if (oleCount(obj.NameTextAttr) > 0) then yes an OLE is found

-Louie