Advanced XML filtering

Hi,
In short: How do I filter an XMLList in ActionScript rather
than E4X, i.e. I am looking for a
replacement of myXmlList.(@attrib == someValue) with
myXmlList.filter(someFilterFunction)
which has the same behaviour (i.e. the result does not
contain copies).
The long story: I have an application that operates on an XML
structure. It uses the E4X filter
mechanism to generate a number of filtered views to display,
using
filteredList:XMLList = myXmlList.(@attrib == someValue)
I now hit the situation that the filter functionality is more
complicated (I basically need access to the whole object and
perform a few calculations to decide whether it's in the list).
First quesiton: Is there an easy way to do this straight on the
XMLList?
I tried something like this
var filteredList:XMLListCollection = new
XMLListCollection(new XMLList());
for each (var n:XML in myXmlList) {
if (logic to decide whether n is in here) {
filteredList.addItem(n); (*** see below)
filteredList = XMLList(filteredList);
But this seems add each item again to myXmlList (so they are
all in there twice now) - no what I want.
Second question: What exactly is the addItem call doing? Why
is it also adding to the XMLList n is from?
I tried
filteredList.addItem(n.copy());
which does not add the items to myXmlList but it makes a copy
which is not what I want (I am updating the
XML and don't want to have copies around). This whole
approach may be complete nosense, I am just
starting to get my head around the XML processing.
Any help or pointers in the right direction are much
appreciated.
Thanks,
Robert

You are so close. You are saying the right words but not
conjuring the right spell. You do want a filtering function - you
want a filterFunction:
var bigList:XMLListCollection = new XMLListCollection(
originaldata );
bigList.filterFunction = uniqueFilter;
private function uniqueFilter( item:Object ) : Boolean {
var test:XML = XML(item);
if( /* some test here */ ) return true; else return false;
bigList.refresh();
If you look at the documentation for XMLListCollection and
then examine the inherited properties and methods, you'll see the
filterFunction property and the refresh method.
I just wrote an article on my blog about filtering
collections. Although I used ArrayCollection, it should similarly
for XMLListCollection.
Filtering
Collections - weblogs.macromedia.com/pent
Basically the filterFunction is given an element of the
Collection and must return true if the element should appear in the
collection's view or false if should not. This does not eliminate
the item from the Collection, just from the view of the Collection.
This way you can change the criteria and refresh() the collection.
If you have a DataGrid's dataProvider bound to the Collection
you'll see it just when the refresh() is done.

Similar Messages

  • Advanced XML View

    Hey guys,
    I wanna create an advanced XML View:
    This is the code in the JS-View:
    new sap.m.Page("page", {
    title : "Test",
    showNavButton : "true",
    showFooter : "true",
    customHeader : new sap.m.Bar({
         contentLeft : [ new sap.m.Button({
         icon : "sap-icon://home",
         tap : function() { app.back();}
         contentMiddle : [ new sap.m.Label("title", { text : "{CategoryName}"
    I started like this:
    <core:View
      controllerName="sap.ui.demo.myFiori.MeineRouteApp.controller.Master"
      xmlns="sap.m"
      xmlns:core="sap.ui.core" >
      <Page
      title="Test"
      showNavButton = "true"
      showFooter = "true"
      customHeader = <Bar>
      </Bar>
      >
    And thats the point I am struggling. How can I create the custumHeader?
    Thanks + regards
    Chris

    Thanks Shilpa, that worked perfect! I am aware now of the difference between how to handle a aggregation and how to handle properties.
    But I got a new problem while creating a new XML-View:
    JavaScript view:
    var oHtml = new sap.ui.core.HTML({
    id: "map_canvas",
    content: '<div id="map_canvas" style="float:left;min-width:500px;width:70%;min-height:600px;height:100%;"></div>'
    XML-View:
    <core:FragmentDefinition
      xmlns="sap.m"
      xmlns:core="sap.ui.core">
      <core:HTML
      id="map_canvas"
      content= " '<div id="map_canvas" style="float:left;min-width:500px;width:70%;min-height:600px;height:100%;"></div>' ">
      </core:HTML>
    </core:FragmentDefinition>
    This time I have the property content, so I mentioned it as a attribute. But I get the error:
    "The value of attribute "content" associated with an element type "core:HTML" must not contain the '<' character."
    It might an error of the single and double quotation marks, but I tested every combination.
    Any further ideas?
    Thanks
    Chris

  • IBot Advanced Properties - Filters

    Hi,
    I've been trying to implement bursting, passing a filter from a master ibot of end users and a filter attribute, for example end user branch, to a content ibot which is branch sales. The idea being the master ibot returns each branch manager and his/her store, the content ibot filters a store sales report for that store and emails the result. Im using SA System area to get the branch managers and their branch names.
    I've been trying to implement what is described in the bookshelf here :
    http://download.oracle.com/docs/cd/E12103_01/books/AnyUser/ibotadvanced.html
    I know its an older version of SA in that bookshelf the but the functionality seems to be there in my release 10.1.3.4
    The ibots run OK, and the emails are sent, but all users in the master ibot are receiving an un-filtered report, even though in my advanced properties im passing the branch name through to the other report, the logical SQL I see in the session manager doesn't seem to reflect a filtered report either.
    Has anybody successfully implemented such a report bursting solution ? I've got 'is prompted' on the branch sales report, and even the user recipient report - Just cant seem to spot why its not getting passed.
    Thanks in advance.

    OK, but re-reading your post I think there problem is that you are not doing it correctly. I don't think you need any master iBot here. In your Answers query simply user the USER session variable to filter all the stores for each user by User ID. If you can't get this in your master query then create another Answer query that gets this data and then use an Advanced Filter in your master Answers query that filters on another Answer query (Advanced => Filter based on results of another request). As you have correctly set the iBot to "Personalized" the iBot will run as each user which means your filter on the USER session variable will get populated correctly the list of stores the user has access to and the users will be able to see their own data only.

  • Data Grid XML filtering

    I cant sem to figure out how to filter my XML data before entering my data grid. I want to load only the XML data with the ID attribute "BALUSTER" and have tried entering:
    data_grid.dataProvider = dp.(@ID == "BALUSTER");
    into my xmlLoaded function without any success.  I am fairly new to as3 and could definitely use the help.  Thanks.
    var dpataProvider;
    var products_xml:XML;
    var xmlReq:URLRequest = new URLRequest("data/products.xml");
    var xml_loader:URLLoader = new URLLoader();
    function xmlLoaded(event:Event):void {
    var ldr:URLLoader = event.currentTarget as URLLoader;
    var xmlDP:XML = new XML(ldr.data);
    dp = new DataProvider(xmlDP);
    data_grid.dataProvider = dp;
    xml_loader.load(xmlReq);
    xml_loader.addEventListener(Event.COMPLETE, xmlLoaded);

    Hard to say without seeing your xml, but something along these lines might work for you:
    import fl.data.DataProvider;
    var rawXml:XML =
    <xml>
    <item ID="BALUSTER">
      <moniker>bubba</moniker>
      <age>50</age>
    </item>
    <item ID="BALUSTER">
      <moniker>bobby-sue</moniker>
      <age>13</age>
    </item>
    <item ID="BULLUSTER">
      <moniker>boo</moniker>
      <age>25</age>
    </item>
    </xml>;
    // use a second XML object to hold the selected nodes
    var data:XML = <data/>;
    data.setChildren(rawXml.item.(@ID == "BALUSTER"));
    var dp:DataProvider = new DataProvider(data);
    data_grid.dataProvider = dp;

  • XML - Filtering on nested children

    Hi,
    Let's say I have some XML like this...
    <cars>
         <car id="1">
           <options>
                <option id="100"/>
                <option id="200"/>
           </options>
         </car>
         <car id="2">
           <options>
                <option id="100"/>
           </options>
         </car>
         <car id="3">
           <options>
                <option id="200"/>
           </options>
         </car>
    </cars>
    I want to query for a list of all cars that have option #200.  Here's what I've tried.
    var list:XMLList = cars.car.(options.option.@id = 200)  // returns nothing
    var list:XMLList = cars.car.options.option.(@id = 200)  // returns option elements, not car elements of course
    var list:XMLList = cars.car.options.option.(@id = 200).parent().parent()  // throws an error
    How can I get the cars?  I've also tried getting the list of matching option elements, then manually looping over them and adding their parents to a new XMLListCollection... but performance was very bad (lots of elements)
    Any ideas?  Thanks!

    Hi,
    Let's say I have some XML like this...
    <cars>
         <car id="1">
           <options>
                <option id="100"/>
                <option id="200"/>
           </options>
         </car>
         <car id="2">
           <options>
                <option id="100"/>
           </options>
         </car>
         <car id="3">
           <options>
                <option id="200"/>
           </options>
         </car>
    </cars>
    I want to query for a list of all cars that have option #200.  Here's what I've tried.
    var list:XMLList = cars.car.(options.option.@id = 200)  // returns nothing
    var list:XMLList = cars.car.options.option.(@id = 200)  // returns option elements, not car elements of course
    var list:XMLList = cars.car.options.option.(@id = 200).parent().parent()  // throws an error
    How can I get the cars?  I've also tried getting the list of matching option elements, then manually looping over them and adding their parents to a new XMLListCollection... but performance was very bad (lots of elements)
    Any ideas?  Thanks!

  • Advanced XML connections

    Hey there!
    I'm fairly new to Flex development so please excuse my
    ignorance if I've just managed to miss some feature or API
    completely!
    My situation is this:
    I wish to develop a program which will communicate with my
    server via a high-performance XML connection using a (currently
    proprietary, open-source later) binary XML format. Since I'm the
    one who has been writing the code for it in Java I have full access
    to the source to port to Flex/action-script. What I'm wondering is
    what (if any) is the standard API for XML parsers
    (readers/writers)? My format is a StAX ("pull") parser for XML
    streams, and I have classes that allow me to use XPaths efficiently
    over it.
    I would like very much to make it using a standard Flex API,
    extending where required to leverage additional features, as this
    would be more useful I think in future when I release it as an
    open-source project.
    Further to this, I will be hoping to use this with an SSL
    connection to keep data private, I am wondering if Flex already has
    SSL functionality, and how fast it is?
    Please don't dispute the use of binary XML here, since I'm
    communicating between two parties then readability isn't an issue
    (except debugging, in which case it's easy to output as text with a
    third party, or by dropping in a regular XML reader/writer). For my
    intended data-set I get around a 40-50% reduction in message size,
    haven't tested relative performance compared to text-XML parsers,
    but it should be faster since it doesn't need to do much work.
    So I'm looking for an idea of what I should implement or
    extend and what I will need to develop from scratch to make this
    work? My aim is to develop this as an AIR application, but may
    compile for browser as well since I have no major requirement for
    local storage.
    Cheers

    Hmm, thanks for the response! While that looks like an
    interesting way of manipulating XML, it appears to be DOM-based?
    The method I'm hoping to implement is StAX or "pull" parsing. A
    simple example (in Java) using my parser could look like this.
    Note: I'm using hyphens in place of working tabs since there seems
    to be no equivalent of <pre> on HTML here that I see:
    Example XML:
    <items>
    - <category>Mixed</category>
    - <item>Bread</item>
    - <item>Monkey</item>
    </items>
    Java code (assuming an XMLStreamReader is positioned inside
    the <items> tag:
    int event;
    while ((event = reader.next()) !=
    XMLStreamConstants.END_DOCUMENT) {
    - switch (event) {
    - - case START_ELEMENT:
    - - String name = reader.getLocalName();
    - - if (name.equals("item"))
    System.out.println("\t"+reader.getElementText());
    - - else if (name.equals("category"))
    System.out.println(reader.getElementText());
    - - break;
    The output of the above would appear (as the data arrives)
    like:
    Mixed
    - Bread
    - Monkey
    Basically, unlike DOM which reads in all the XML and provides
    you with a model you can then pull elements out from, a StAX parser
    lets you tell the parser when to parse, it tells you what it found
    and you can then decide what to do with that data. It's very good
    for using as an XPath stream parser, as you can look for an XPath
    match on an XML document hundreds of megabytes in size, without
    ever using more than a few kilobytes of memory. Disadvantage of
    course is that once you've passed an XML element, you can't go back
    unless you saved it somewhere.
    My XMLStreamReader is fairly easy to adapt into use as a DOM
    parser as well, and it's pretty good at that too, but I try to
    avoid DOM like the plague where possible.
    If Flex only has DOM available then I would like port my
    parser as a mirror image of the Java parser, and hope that any
    future Flex StAX parser standard is similar enough to easily mash
    my code into at that time.

  • JMS XML filtering using JMS_BEA_SELECT

    Can anyone provide some working examples of JMS_BEA_SELECT built-in. I cannot get any kind of filter to work. Is there any way to debug this ? Is there another way to filter jms messages which are weblogic.jms.extensions.XMLMessage ? If JMS_BEA_SELECT doesn't work then what's the point of the XMLMessage ?
              thanks
              acp

    Can anyone provide some working examples of JMS_BEA_SELECT built-in. I cannot get any kind of filter to work. Is there any way to debug this ? Is there another way to filter jms messages which are weblogic.jms.extensions.XMLMessage ? If JMS_BEA_SELECT doesn't work then what's the point of the XMLMessage ?
              thanks
              acp

  • [UNSOLVED] Event Log Custom XML Query Filtering Help

    I've looked at a few different posts but I must be missing something because what I'm constructing isn't working.
    Here's the XML code of an example event:
    - <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    - <System>
    <Provider Name="ERAS WCF" />
    <EventID Qualifiers="0">0</EventID>
    <Level>4</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2014-07-09T20:32:51.000000000Z" />
    <EventRecordID>899070</EventRecordID>
    <Channel>Application</Channel>
    <Computer>server.f.q.d.n</Computer>
    <Security />
    </System>
    - <EventData>
    <Data>User [email protected] has submitted 'Get BIOS Information' operation from servername to computername.f.q.d.n.</Data>
    </EventData>
    </Event>
    This is my query:
    <QueryList>
    <Query Id="0">
    <Select Path="Application">*[EventData[Data and (Data='computername' or Data='ip.add.re.ss')]]</Select>
    </Query>
    </QueryList>
    I always get 0 results, even if I take stabs in the dark:
    *[System[(Level=1  or Level=2 or Level=3 or Level=4 or Level=0 or Level=5)]]
    *[EventData[Data and (Data='*computername*')]]
    *[EventData[Data and (Data='%computername%')]]
    I used this post as my guide for filtering based on content: http://blogs.technet.com/b/askds/archive/2011/09/26/advanced-xml-filtering-in-the-windows-event-viewer.aspx
    Also:
    I hope this is the right place for this question.  This said to post in the server
    forums, but in
    the server forums, it said to post here.
    I happen to be doing this on a server, but it could just as easily be a desktop.

    Hello,
    Thanks for posting question to this forum. Since this forum is related with XPath, what I can do is to help you validate your XPath query. With your query, I tested them with my computer, however, all of them could load event record correctly:
    Query:*[EventData[Data and (Data='Office12AssertTimer' or Data='6.3.9600.17031')]]
    Result:
    Query:*[System[(Level=1  or Level=2 or Level=3 or Level=4 or Level=0 or Level=5)]]
    Result:
    So your XPath query is ok. Do you have a try to use the same query to filter the event log to check if there are records with another computer? I am wondering if there is something wrong with your current computer.
    And since the XPath is ok, I would like suggest you posting it to the server forum to see if there are others looking into it.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • User being removed from Domain Admins...how to find all servers his account is being used.

    We have a user that is being removed from IT (more like being forcefully demoted) and our owner still finds him valuable in other departments. My challenge is to find all servers that he may be using his account locally on (as a service or added to a local
    admin group). It hasn't happened yet, but we need to be prepared to say we know all the servers his account is on when the owner demotes him.
    I'm hoping someone has an approach to this that doesn't include going through tons of Event Viewer Security logs. We do have System Center Configuration Manager and Operations Manager 2012 w/ SP1, but the guy that is responsible for those is the guy we are removing
    and none of us are aware on how to use the possible tools that those have. If you feel that those would do the trick then please point me to a "how to" and I'll try to learn on the fly. Otherwise I'll take any other suggestions.
    ~Rick

    Hi Rick,
    Based on my research, you can filter events logs based on user name and event ID:
    Advanced XML filtering in the Windows Event Viewer
    http://blogs.technet.com/b/askds/archive/2011/09/26/advanced-xml-filtering-in-the-windows-event-viewer.aspx
    Best Regards,
    Amy

  • Audit directory and searching through the logs for deleted file

    Windows Server 2003
    I have found article http://whatevernetworks.com/?p=108
    And in description of this article is: to found deleted files in auditing directory I have to found event 560.
    But I have about 60 000 events.
    My file abcd.txt is missing and I have to find who delete it, but I cant click 60 000 times to find it.
    Moreover most of that event looks like its objcect open not object deleted.
    How to find this particular?
    Event Type:    Success Audit
    Event Source:    Security
    Event Category:    Object Access
    Event ID:    560
    Date:        2/23/2014
    Time:        11:48:00 PM
    User:        DOMAIN\user
    Computer:    PLWAW1FS00003
    Description:
    Object Open:
         Object Server:    Security
         Object Type:    File
         Object Name:    E:\Temp\download.domain.com\example.zip
         Handle ID:    1788
         Operation ID:    {0,477992664}
         Process ID:    1692
         Image File Name:    C:\WINDOWS\system32\xcopy.exe
         Primary User Name:    user
         Primary Domain:    DOMAIN
         Primary Logon ID:    (0x0,0x1C7D2FA0)
         Client User Name:    -
         Client Domain:    -
         Client Logon ID:    -
         Accesses:    DELETE
                READ_CONTROL
                WRITE_DAC
                WRITE_OWNER
                SYNCHRONIZE
                ACCESS_SYS_SEC
                ReadData (or ListDirectory)
                WriteData (or AddFile)
                AppendData (or AddSubdirectory or CreatePipeInstance)
                ReadEA
                WriteEA
                ReadAttributes
                WriteAttributes
         Privileges:    SeBackupPrivilege
                SeRestorePrivilege
         Restricted Sid Count:    0
         Access Mask:    0x11F019F
    Find fields are: Information/Warning/Error/Succes/Failure
    Event source: DS/IIS/LSA etc...
    Event ID:
    User:
    Computer:
    Description:
    and no filename, or action.
    Maybe I can use powershell to search through the logs?

    Hi,
    You can use Custom View and XML filter to filter specific event logs. Firstly, create a custom view. Then type an XML query to filter by ObjectName (abcd.txt).
    For more detailed information, please refer to the article below:
    Advanced XML filtering in the Windows Event Viewer
    http://blogs.technet.com/b/askds/archive/2011/09/26/advanced-xml-filtering-in-the-windows-event-viewer.aspx
    Regards,
    Mandy
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Has anyone figured out how to use EventCombMT to do "text" searches of server event logs? I doesn't seem to work.

    I know I can do this in powershell, but gosh I don't need a complex powershell script to do what this eventcombmt gui does so easily for quick searches.  I just wish I could figure out why text based searches of logs.  For example, suppose
    you want to search events for a user a server may have logged, if I type in "user1" nothing is retrieved and yes it's there.  Searching for events works flawlessly but I can't seem to get text based searches to work. 

    Hi,
    Based on my research, if we want to filter events based on user name, we need to edit the XML query.
    Please refer to this blog below:
    Advanced XML filtering in the Windows Event Viewer
    http://blogs.technet.com/b/askds/archive/2011/09/26/advanced-xml-filtering-in-the-windows-event-viewer.aspx
    Best Regards,
    Amy

  • Who has figured out how to use a print server with LR 2.1?

    Who has figured out how to use a print server with LR 2.1?
    Mac OS 10.4.11, G5 2.3 dual, 8 GB RAM. PS CS 3 Dual monitors
    Print server is Mac G4 dual 533 (audio)
    Epson Pro 9600 and Epson R2400 Both are connect by USB. Could be connected with FW 400.
    I can use a print server with PS However color management does not come through when using a print server and LR. Image prints, but color horrendous.
    All custom .icc profiles are on both the G5 and the print server, G4 dual 533 (audio)

    Hi,
    Based on my research, if we want to filter events based on user name, we need to edit the XML query.
    Please refer to this blog below:
    Advanced XML filtering in the Windows Event Viewer
    http://blogs.technet.com/b/askds/archive/2011/09/26/advanced-xml-filtering-in-the-windows-event-viewer.aspx
    Best Regards,
    Amy

  • How to check when admin or some other account has been logging in to the server

    Hi
    How can I check when admin or some other particular account has logged in to the server? So that I can check login times for users.

    Hi,
    You can try to edit the XML file to filter events by logon types.
    In addition, explicit credentials mean that we input our user name and password in front of a computer through keyboard (or other more advanced means). After that, Windows system will pack our credentials as tickets for further
    purposes like access network resources, tickets are implicit credentials.
    More information for you:
    Advanced XML filtering in the Windows Event Viewer
    http://blogs.technet.com/b/askds/archive/2011/09/26/advanced-xml-filtering-in-the-windows-event-viewer.aspx
    Best Regards,
    Amy

  • Exception to audit tmp files deleted in Win2008 Server

    I need to prevent the event viewer record deleted tmp files when I use the audit  fileserver 2008,  because the log file is too large .

    Hi,
    We could not exclude tmp files from being logged in the security audits. Since the file system doesn't have a special "type" for temporary files, we also cannot fileter tmp files in security audit logs.
    For more detailed information, please refer to the article below:
    Advanced XML filtering in the Windows Event Viewer
    http://blogs.technet.com/b/askds/archive/2011/09/26/advanced-xml-filtering-in-the-windows-event-viewer.aspx
    Best Regards,
    Mandy
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Can we have more than 2 "and/or" conditions in filters in advanced mode in power view?

    Hi,
    I need to check 3 conditions in filter in advanced mode in power view. Is it possible out-of-box. Can we customize the advanced mode filters or do we have some configurable options for same.
    Thanks,
    Bhawna.

    Hi Bhawna,
    I'm the Dev Owner for the filtering experience in Power View.  Sorry it took so long for me to reply.
    In the Power View Advanced Filter cards, you cannot currently add more than two conditions.  What Rhys meant about having as many AND filter conditions as you like is that because all of the filter cards are AND-ed together, you can effectively have
    more than two filter conditions by adding multiple 'LastModifiedDate' cards.
    Unfortunately this won't help you if you're looking to OR more than two conditions.
    Adding the ability to have more than two conditions in a single Advanced Filter card is something that is near and dear to my heart, but it does open questions of nesting and grouping which would need to be addressed first in order to be able to offer a
    complete solution.
    Hope this helps,
    Jeremy

Maybe you are looking for

  • Record Navigation Problem

    Hi All! I have a Master-Detail Form, when I execute query using F8 key then query executed successfully. So, now I want to make change in Detail Block, when I make change in Detail Block and then I move to first block and want to navigate to next rec

  • Find the path of a string using methods

    Dear Gurus , I have the path " filestltrv\sap\mauals\text.xls' and i want using Methods in ABAP  to find the path '" filestltrv\sap\mauals\'. I suppose using loops and with finding '\' i will do it . Is any other Way ???? Thanks a lot !!!!

  • File move in ODI

    Hii...Experts.. I have done a process which takes Files from a directory and load to a single table in one interface(multiple file/single table interface). but I want to move those files to DONE directory which is loaded to table successfully and mov

  • Icons doesnt wiggle

    icons on the screen doesnt wiggle when i tap and hold.Am able to re-arrange the icons though itunes though.I had this issue much before upgrading to IOS4.Any thoughts are appreciated.

  • AMD A8 x Windows 8.1 x HP

     I got the second Pavillion AMD A8 in 4 days. At first I thought it was a keyboard defect, exchanged it ! Now I gues the machine is fighting against me - be it a spreadsheet, and e-mail or a game it freezes all the time, the charm bar pop's up with n