XML Filteration Control
December 3, 2010 8:41 AM   Subscribe

I am looking for a Filter Builder control to accept user input to filter XML data. The Filter control should be for Windows Forms (not Web pages), and it should have end-user capabilities to specify complex filter criteria.

Example XML for a Sales transaction:

<Envelope>
  <Sales>
    <TransNumber>1</TransNumber>
    <Date>1-Apr-2010</Date>
    <ItemList>
      <SlNo>1</SlNo>
      <ItemName>Paper Ream</ItemName>
      <Qty>10</Qty>
      <UOM>Bundles</UOM>
      <Rate>300.00</Rate>
      <Amount>3000.00</Amount>
      <BatchList>
        <BatchName>Reel 1</BatchName>
        <MfgDate>1-Jan-2010</MfgDate>
        <Qty>6</Qty>
      </BatchList>
      <BatchList>
        <BatchName>Reel 2</BatchName>
        <MfgDate>1-Feb-2010</MfgDate>
        <Qty>4</Qty>
      </BatchList>
    </ItemList>
    <ItemList>
      <SlNo>2</SlNo>
      <ItemName>Bubble Gum</ItemName>
      <Qty>20</Qty>
      <UOM>Nos</UOM>
      <Rate>5.00</Rate>
      <Amount>100.00</Amount>
    </ItemList>
  </Sales>
  <ItemMaster>
    <Name>Paper Ream</Name>
    <ProductGroup>Paper Products</ProductGroup>
    <ProductCategory>Manufactured Items</ProductCategory>
    <HasBatches>Yes</HasBatches>
  </ItemMaster>
  <ItemMaster>
    <Name>Bubble Gum</Name>
    <ProductGroup>Chewing Gum</ProductGroup>
    <ProductCategory>Traded Items</ProductCategory>
    <HasBatches>No</HasBatches>
  </ItemMaster>
</Envelope>



In the above example, the XML contains details of items in the Sales Transaction, as well as the master data for the items sold.
User should be able to specify complex query conditions like:

Sales having ItemList having BatchList having BatchName equal to "Reel 2"
and having Qty > 2
and having ProductCategory containing "Traded"
and having Date <= 10-Apr-2010

Note that I am looking for a .NET WinForms control which can accept dynamic user input upto any level based on an XML schema.

For example, in the GUI control,
1st column should show a dropdown containing "Sales" and "ItemMaster" - the 2 main tags under the Envelope tag.

As soon as user selects Sales, the next column should show "having". The next column should show all child nodes of Sales node, i.e. TransNumber, Date, ItemList.

As soon as user selects ItemList, the next column should show all attributes of the ItemList i.e. SlNo, ItemName, Qty, UOM, Rate, Amount, BatchList. Also the ItemList should be linked to the ItemMaster node, so this column should also show attributes belonging to the ItemMaster node i.e. Name, ProductGroup, ProductCategory, HasBatches, etc.

This should be totally dynamic, should support linking of 2 nodes like linking ItemList node to ItemMaster node, and should support any no. of levels.

Is there such a GUI control available? If not, how can it be programmed. I am willing to pay for development cost also.
posted by inquisitive to Computers & Internet (8 answers total)
 
I would be very surprised if a control like this existed. And I'm not sure that the control should really be responsible for anything more than specifying the query; the code that actually performs the query is going to look different depending on the data's size/location (in memory? on disk? somewhere over the network?). Likely, you'd want to have the control specify the query, and then have a few different strategies for executing the query depending on the data (unless you know these ahead of time and expect them never to change).

Also the ItemList should be linked to the ItemMaster node, so this column should also show attributes belonging to the ItemMaster node i.e. Name, ProductGroup, ProductCategory, HasBatches, etc.

This should be totally dynamic, should support linking of 2 nodes like linking ItemList node to ItemMaster node


These relationships need to be specified in your schema (or, by the user, on the control, I guess). I would again be surprised if any tool could infer them on its own.
posted by a snickering nuthatch at 9:22 AM on December 3, 2010


What you are asking for is pretty ambitious - I don't know if such a thing exists. Something to keep in mind is that the XML part of your question is almost incidental - a well-written GUI control would not be so tightly coupled with the data source.

I have only recently began dabbling into the MS side of programming, but your question screams LINQ, and LINQ to XML in particular to me. Have a look at it, that's what I would start looking at if I was trying to implement the functionality you describe using standard Windows Forms controls.
posted by Dr Dracator at 9:41 AM on December 3, 2010


Response by poster: Basically I am just looking for a control to accept user input up to any levels of query; the actual filteration will be done by my code by reading the user specified values from the control.

DevExpress seems to have such a control Filter Builder, but it is based on a DataTable I guess. Also it is for web based input, not for Windows Forms.
posted by inquisitive at 10:44 AM on December 3, 2010


Response by poster: Just if somebody can tell me how to write such a control myself coz I will not know in advance how many dropdowns to have i.e. how many columns required for user input as XML can be nested up to any level.

So if you can tell me how to build such a GUI myself which should expand horizontally (i.e. keep on adding columns dynamically if child nodes exist).
posted by inquisitive at 10:46 AM on December 3, 2010


It sounds like you're re-inventing Microsoft Access' query tool to run against raw XML documents.
posted by rhizome at 11:20 AM on December 3, 2010


Response by poster: Jpfed, you are right. I just want the control for specifying the query. If such a control does not exist, can you suggest a way to build such a user interface on my own? Do you know somebody who will be willing to do this on a paid basis?
posted by inquisitive at 1:23 PM on December 3, 2010


I will not know in advance how many dropdowns to have

There isn't really a fixed number here for what you're asking. You'd have to instantiate the dropdowns at run-time (not design-time) and add those instances to the form.
posted by a snickering nuthatch at 2:38 PM on December 3, 2010


Most browsers have XSL-T support. I'd write the filter as javascript that built up XSL-T/XPATH code and ignore .NET entirely except for having something that produces some textboxes (for the input/xslt/output).
posted by holloway at 3:30 PM on December 3, 2010


« Older Tech Know Nothing guy needs help   |   Looking for a gentle, compassionate dentist in... Newer »
This thread is closed to new comments.