Topic
  • 6 replies
  • Latest Post - ‏2014-04-10T18:57:02Z by llandale
PDU
PDU
139 Posts

Pinned topic filtering on OLE

‏2012-03-02T08:30:20Z |
Hi,

is it possible create a filter like :
i want see only Objects with OLE inside.
Pierre
Updated on 2012-03-02T12:32:41Z at 2012-03-02T12:32:41Z by SystemAdmin
  • Peter_Albert
    Peter_Albert
    250 Posts

    Re: filtering on OLE

    ‏2012-03-02T09:10:20Z  

    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
    
    Updated on 2014-01-06T18:12:48Z at 2014-01-06T18:12:48Z by iron-man
  • PDU
    PDU
    139 Posts

    Re: filtering on OLE

    ‏2012-03-02T09:21:10Z  

    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
     

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">// 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 </pre>
    thanks very much
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: filtering on OLE

    ‏2012-03-02T12:29:36Z  
    • PDU
    • ‏2012-03-02T09:21:10Z
    thanks very much
    Module m = current

    Object o

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

    filtering on
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: filtering on OLE

    ‏2012-03-02T12:32:41Z  
    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
    
    Updated on 2014-01-06T18:13:18Z at 2014-01-06T18:13:18Z by iron-man
  • DiBob
    DiBob
    1 Post

    Re: filtering on OLE

    ‏2014-04-09T07:34:50Z  

    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
     

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">// 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 </pre>

    Thank you Peter, your script is working very well.

  • llandale
    llandale
    3035 Posts

    Re: filtering on OLE

    ‏2014-04-10T18:57:02Z  

    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