Search Results

Search found 5101 results on 205 pages for 'expression trees'.

Page 80/205 | < Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >

  • How to access class member from bison action

    - by yodhevauhe
    I am calling yyparse from a member function. How to access the member variables/function from the bison action. I am currently doing as %{ #include "myclass.h" #include "parse.tab.hh" MyClass *ptr=NULL; void MyClass::evaluate(string expression) { ptr=this; yy_scan_string(expression.c_str()); yyparse(); } %} %% EXPR : EXPR PLUS EXPR { $$ = ptr->memberFunction("+",$1,$3); }

    Read the article

  • Specializing a template on a lambda in C++0x

    - by Tony A.
    I've written a traits class that lets me extract information about the arguments and type of a function or function object in C++0x (tested with gcc 4.5.0). The general case handles function objects: template <typename F> struct function_traits { template <typename R, typename... A> struct _internal { }; template <typename R, typename... A> struct _internal<R (F::*)(A...)> { // ... }; typedef typename _internal<decltype(&F::operator())>::<<nested types go here>>; }; Then I have a specialization for plain functions at global scope: template <typename R, typename... A> struct function_traits<R (*)(A...)> { // ... }; This works fine, I can pass a function into the template or a function object and it works properly: template <typename F> void foo(F f) { typename function_traits<F>::whatever ...; } int f(int x) { ... } foo(f); What if, instead of passing a function or function object into foo, I want to pass a lambda expression? foo([](int x) { ... }); The problem here is that neither specialization of function_traits<> applies. The C++0x draft says that the type of the expression is a "unique, unnamed, non-union class type". Demangling the result of calling typeid(...).name() on the expression gives me what appears to be gcc's internal naming convention for the lambda, main::{lambda(int)#1}, not something that syntactically represents a C++ typename. In short, is there anything I can put into the template here: template <typename R, typename... A> struct function_traits<????> { ... } that will allow this traits class to accept a lambda expression?

    Read the article

  • Is there a more modern regexp handler for Open Object Rexx

    - by Brent.Longborough
    The regular expression class (rxregexp.dll) that comes with ooRexx (I'm on 4.0.0) is relatively low on function compared, say, with Python's re module (even at 2.5.2). It appears to have no assertions, no facilities for group extraction, or for substitution. Greedy or lazy matching is a global pattern option, rather than flagged by an additional "?". Basically, a pre-PCRE regular expression engine. Does anyone know if anything with more up-to-date function is available?

    Read the article

  • child objects in rdlc (Studio 2010RC)

    - by Jim
    Hi, I am attempting to reference a sub-object in a field expression in a studio 2010 report. This used to work in prior versions. When account references another object with properties the following used to work. =Fields!Account.Value.Name (Name is a property of the child object, Account is the parent object) The same expression syntax no longer works. How do I reference the properties of a sub-object in reporting services in an rdlc in studio 2010. Thanks

    Read the article

  • In Java, is it possible for a super constructor invocation actually invoke a constructor in the calling class?

    - by John Assymptoth
    Super constructor invocation definition: [Primary.] [NonWildTypeArguments] super ( ArgumentListopt ) ; A super constructor call can be prefixed by an Primary expression. Example (taken from JLS): class Outer { class Inner{ } } class ChildOfInner extends Outer.Inner { ChildOfInner() { (new Outer()).super(); // (new Outer()) is the Primary } } Does a Primary expression exist that makes the call to super() the invocation of a constructor of the calling class? Or Java prevents that?

    Read the article

  • Why doesn't Java warn about a == "something"?

    - by Marius
    This might sound stupid, but why doesn't the Java compiler warn about the expression in the following if statement: String a = "something"; if(a == "something"){ System.out.println("a is equal to something"); }else{ System.out.println("a is not equal to something"); } I realize why the expression is untrue, but AFAIK, a can never be equal to the String literal "something". The compiler should realize this and at least warn me that I'm an idiot who is coding way to late at night.

    Read the article

  • uncaught exception: Syntax error after jQuery upgrade

    - by wham12
    I am trying to upgrade an existing application from jQuery 1.3.2 to jQuery 1.4.2. When I do this, the page fails to load correctly and firefox's error console displays the error message "uncaught exception: Syntax error, unrecognized expression: Syntax error, unrecognized expression: search". How can I determine what is causing this exception?

    Read the article

  • Regex for Password Must be contain at least 8 characters, least 1 number and both lower and uppercase letters and special characters

    - by user2442653
    I want a regular expression to check that Password Must be contain at least 8 characters, including at least 1 number and includes both lower and uppercase letters and special characters (e.g., #, ?, !) Cannot be your old password or contain your username, "password", or "websitename" And here is my validation expression which is for 8 characters including 1 uppercase letter, 1 lowercase letter, 1 number or special character. (?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$" How I can write it for password must be 8 characters including 1 uppercase letter, 1 special character and alphanumeric characters?

    Read the article

  • HtmlHelperExtensions are not visible in view mvc3 asp.net

    - by user1299372
    I've added a class for the HTML Custom Extensions: using System; using System.Linq.Expressions; using System.Text; using System.Web.Mvc; using System.Web.Mvc.Html; namespace App.MvcHtmlHelpers { public static class HtmlHelperExtensions { public static MvcHtmlString ComboBox(HtmlHelper html, string name, SelectList items, string selectedValue) { var sb = new StringBuilder(); sb.Append(html.DropDownList(name + "_hidden", items, new { @style = "width: 200px;", @onchange = "$('input#" + name + "').val($(this).val());" })); sb.Append(html.TextBox(name, selectedValue, new { @style = "margin-left: -199px; width: 179px; height: 1.2em; border: 0;" })); return MvcHtmlString.Create(sb.ToString()); } public static MvcHtmlString ComboBoxFor<TModel, TProperty>(HtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, SelectList items) { var me = (MemberExpression)expression.Body; var name = me.Member.Name; var sb = new StringBuilder(); sb.Append(html.DropDownList(name + "_hidden", items, new { @style = "width: 200px;", @onchange = "$('input#" + name + "').val($(this).val());" })); sb.Append(html.TextBoxFor(expression, new { @style = "margin-left: -199px; width: 179px; height: 1.2em; border: 0;" })); return MvcHtmlString.Create(sb.ToString()); } I've also registered it in my site web config: <namespaces> <add namespace="System.Web.Helpers" /> <add namespace="System.Web.Mvc" /> <add namespace="System.Web.Mvc.Ajax" /> <add namespace="System.Web.Mvc.Html" /> <add namespace="System.Web.Routing" /> <add namespace="System.Web.WebPages" /> <add namespace="App.MvcHtmlHelpers"/> </namespaces> In my view, I import the namespace: <%@ Import Namespace="RSPWebApp.MvcHtmlHelpers" %> But when I go to call it in the view, it doesn't recognize the custom extension. Can someone help me by telling me what I might have missed? Thanks so much in advance! <%:Html.ComboBoxFor(a => a.Street2, streetAddressListItems) %

    Read the article

  • How to create dynamic number of output files with SSIS?

    - by JSacksteder
    I will be creating flatfiles and based on the data in the batch, it might be necessary to split the data into an undetermined number of files. I can make the connection string dynamic with an expression, but that is only evaluated when the package starts. I'd like to change that expression to include a '-a' or '-b' in the filename. Alternately, if I have to create new connection manager objects at run time on demand, how do I go about that?

    Read the article

  • help with regex needed

    - by user268375
    I need a regular expression with the following needs: the string is alphanumeric and have exactly 6 characters in the first half followed by hyphen(optional) followed by optional 4 characters:(cannot have more than 4 characters in the second half) so any of the following is valid 11111A 111111-1 111111-yy yyyyy-989 yyyyyy-9090 i thought this expression /[a-zA-Z0-9]([-])?[a-zA-Z0-9]{5,10}$/; should work but i m unable to get it working correctly. Any help will be appreciated,

    Read the article

  • DataColumn expressions

    - by Kumar
    What is the most complex expression you've seen/used ? and what's the limit on the length of the expression that can be used ? I seem to recall something to that effect a while back but can't locate it now !!

    Read the article

  • How can you remove a Criterion from a criteria?

    - by ChuckM
    Hello, For instance if I do something like: Criteria c = session.createCriteria(Book.class) .add(Expression.ge("release",reDate); .add(Expression.ge("price",price); .addOrder( Order.asc("date") ) .setFirstResult(0) .setMaxResults(10); c.list(); How can I use the same criteria instance, but remove (for example) the second criterion? I'm trying to build a dynamic query in which I'd like to let the user remove a filter, without the backend having to reconstruct the criteria from scratch. Thank you

    Read the article

  • Does this e-mail-regex exclude valid addresses?

    - by neo
    I tried to create a regular expression which catches all RFC-valid addresses but it's ok if some false-positives come through (though hopefully not so many). This is waht I came up so far: /^\b\S+@\S+\.[^\s@]{2,}\b$/ Is there any RFC-valid address which doesn't match against this expression or do you have any suggestions to improve it? I don't mind the false positives but I would be glad if you show me a few, too.

    Read the article

  • Javascript regular expressions: how to match ONLY the given characters?

    - by Dfowj
    I'm trying to use a regex like /[computer]{3,8}/ to get any words containing only the letters in computer ranging from 3 to 8 letters long. That regex instead captures all words containing ANY of the letters in [computer]. I've been looking at regular expression examples, but i can't quite figure it out... How do i modifiy this regular expression to capture words containing ONLY the letters in computer (with a length of 3 to 8)?

    Read the article

  • Haskell "Source reduction"

    - by Martin
    I'm revising for an upcoming Haskell exam and I don't understand one of the questions on a past paper. Google turns up nothing useful fst(x, y) = x square i = i * i i) Source reduce, using Haskells lazy evaluation, the expression: fst(square(3+4), square 8) ii) Source reduce, using strict evaluation, the same expression iii) State one advantage of lazy evaluation and one advantage of strict evaluation

    Read the article

  • Copying an entire table with Postgres

    - by NudeCanalTroll
    Hello, I'm trying to copy the contents of one table into another in Postgres, however it appears some rows aren't being copied correctly: ActiveRecord::StatementInvalid: PGError: ERROR: column "email_date" is of type timestamp without time zone but expression is of type character varying HINT: You will need to rewrite or cast the expression. Is there any way I can have it automatically skip (or ignore) invalid rows? Here's the query I'm using: SET statement_timeout = 0; INSERT INTO emails3 SELECT * FROM emails

    Read the article

  • Handling a colon in an element ID in a CSS selector

    - by sblundy
    JSF is setting the ID of an input field to search_form:expression. I need to specify some styling on that element, but that colon looks like the beginning of a pseudo-element to the browser so it gets marked invalid and ignored. Is there anyway to escape the colon or something? input#search_form:expression { ///... }

    Read the article

  • Doubt in Conditional inclusion

    - by Philando Gullible
    This is actually extracted from my module (Pre-processor in C) The conditional expression could contain any C operator except for the assignment operators,increment, and decrement operators. I am not sure if I am getting this statement or not since I tried using this and it worked.Also for other manipulation a probable work around would be to simply declare macro or function inside the conditional expression,something like this to be precise. Also I don't understand what is the rationale behind this rule. Could somebody explain? Thanks

    Read the article

  • Passing template into boost function

    - by Ockonal
    template <class EventType> class IEvent; class IEventable; typedef boost::function<void (IEventable&, IEvent&)> behaviorRef; What is the right way for passing template class IEvent into boost function? With this code I get: error: functional cast expression list treated as compound expression error: template argument 1 is invalid error: invalid type in declaration before ‘;’ token

    Read the article

  • Recursive move utility on Unix?

    - by Thomas Vander Stichele
    Sometimes I have two trees that used to have the same content, but have grown out of sync (because I moved disks around or whatever). A good example is a tree where I mirror upstream packages from Fedora. I want to merge those two trees again by moving all of the files from tree1 into tree2. Usually I do this with: rsync -arv tree1/* tree2 Then delete tree1. However, this takes an awful lot of time and disk space, and it would be much easier to be able to do: mv -r tree1/* tree2 In other words, a recursive move. It would be faster because first of all it would not even copy, just move the inodes, and second I wouldn't need a delete at the end. Does this exist ? As a test case, consider the following sequence of commands: $ mkdir -p a/b $ touch a/b/c1 $ rsync -arv a/ a2 sending incremental file list created directory ./ b/ b/c1 b/c2 sent 173 bytes received 57 bytes 460.00 bytes/sec total size is 0 speedup is 0.00 $ touch a/b/c2 What command would now have the effect of moving a/b/c2 to a2/b/c2 and then deleting the a subtree (since everything in it is already in the destination tree) ?

    Read the article

  • CodePlex Daily Summary for Thursday, June 10, 2010

    CodePlex Daily Summary for Thursday, June 10, 2010New Projectscab mgt: j mmmjk kjkjCAML Generator: CAMLBuilder makes it easier for generating CAML Query from code. It can be extensively used while Sharepoint Customization thru code. You no longer...Cloud Business Services: ISV Application Accelerator for business management of Cloud Applications build on Windows Azure or any hosting platform. Cloud Business Services ...Community Server 2.1 to WordPress WXL Exporter: This is a simple program to export all CS 2.1 posts and tags by a particular user to WordPress WXL format. DbIdiom for ADO.NET Core: DbIdiom is a set of idioms to use ADO.NET Core (without Dataset) easily.dotsoftRAID: This project is a software for using RAID on windows without special hardware ("Software RAID").DTSRun Job Runner: DTSJobRun makes it easier for SQL Server Developer to control DTS Job through 3rd party execution manager or process control or monitoring control ...Easy Share: Folder sharing is an indispensable part of our professional life. 'EasyShare' is a folder share creation, deletion and editing tool with integrated...elmah2: A project inspired by elmah (http://code.google.com/p/elmah/) The primary goals of this project are -> A plugin style architecture for logging ...Entropy: Entropy is a component for implementing undo/redo for object models. Entropy implements undo/redo with the memento pattern at the object level so t...eXtremecode Generator: eXtremecode generator is a code generator which makes it easier for asp.net developers to generate a well formed asp.net application by giving it j...GreenBean Script: GreenBean Script is a .NET port of the game-focussed scripting language, GameMonkey Script (http://www.somedude.net/gamemonkey) The first release ...IMAP POP3 SMTP Component for .NET C#, VB.NET and ASP.NET: The Ultimate Mail Component offers a comprehensive interface for sending, receiving e-mail messages from a server and managing your mailbox remotel...PRISM LayoutManager / WindowManager: A layout manager for PRISMSharePoint 2010 Taxonomy Import Utility: Build SharePoint 2010 taxonomies from XML. The SharePoint 2010 Taxonomy Import Utility allows taxonomy authors to define complete taxonomies in XML...SharePoint Geographic Data Visualizer: SharePoint Geographic Data Visualizer includes an Asp.Net server control and Microsoft Sharepoint web part which your users can use to visualize an...Silverlight Reporting: Silverlight Reporting is a simple report writer test bed for Silverlight 4+. The intent is to provide the basics of report writing while being flex...SSIS Expression Editor & Tester: An expression editing and testing tool for SQL Server Integration Services (SSIS). It also offers a reusable editor control for custom tasks or oth...STS Federation Metadata Editor: This is a federation metadata editor for Security Token Services (STS). STSs can be created on any platform (as long as it's based on the oasis sta...WebShopDiploma: WebShopDiploma is a sample application.WEI Share: WEI Share is an application for sharing your Windows Experience Index (WEI) scores from Windows 7 with others in the community. The data can be exp...New Releases.NET Transactional File Manager: 1.1.25: Initial CodePlex release. Code from Chinh's blog entry, plus bug fixes including one from "Mark".Active Directory Utils: Repldiag 2.0.3812.27900: Addressed a bug where lingering objects could not be cleaned due to unstable replication topologies resulting from the reanimation of lingering obj...Ajax ASP.Net Forum: developer.insecla.com-forum_v0.1.3: VERSION: 0.1.3 FEATURES Same as 0.1.2 with some bugs fixed: - Now the language/cultures DropDownList selectors works showing the related lang/cult...BigfootMVC: Development Environment Setup DNN 5.4.2: This is DNN development environment setup including the dabase. Does not include the TimeMaster / BigfootMVC code. BigfootMVC is in the source cont...CAML Generator: Version 1.0: Version 1.0 has been released. It is available for download. Version is stable and you can use it. If you have any concerns then please post issue...Community Forums NNTP bridge: Community Forums NNTP Bridge V35: Release of the Community Forums NNTP Bridge to access the social and anwsers MS forums with a single, open source NNTP bridge. This release has ad...Community Server 2.1 to WordPress WXL Exporter: CStoWXL_v1.0: First (and probably only) release. Exports posts and tags bases on supplied user name. Does not do comments or attachments. To run, do the followin...DbIdiom for ADO.NET Core: DBIdiom for ADO.NET Core 1.0: DBIdiom for ADO.NET Core 1.0DocX: DocX v1.0.0.9: ImportantA bug was found in Table.SetDirection() by Ehsan Shahshahani. I have fixed this bug and updated version 1.0.0.9 of DocX. I did not want to...Easy Share: EasyShare ver 1.0: Version 1.0 of Easy Folder Share toolEnterprise Library Extensions: Release 1.2: This release contains Windows Communication Foundation service behavior which makes it possible to resolve services using Unity either by applying ...Excel-Dna: Excel-Dna Version 0.26: This version adds initial support for the following: Ribbon support for Excel 2007 and 2010 and hierarchical CommandBars for pre-2007 versions. D...Exchange 2010 RBAC Editor (RBAC GUI) - updated on 6/09/2010: RBAC Editor 0.9.4.2: only small GUI fixes; rest of the code is almost same with version 0.9.4.1 Please use email address in About menu of the tool for any feedback and...eXtremecode Generator: eXtremecode Generator 10.6: Download eXtremecode Generator. Open Connections.config file from eXDG folder. Define required connections in Connections.config file. (multi...FAST for Sharepoint MOSS 2010 Query Tool: Version 1.1: Added Search String options to FQL Added options for Managed Property queryGiving a Presentation: RC 1.2: This new release includes the following bug fixes and improvements: Bug fix: programs not running when presentation starts are not started when pre...HKGolden Express: HKGoldenExpress (Build 201006100300): New features: User can add emotion icons when posting new message or reply to message. Bug fix: (None) Improvements: (None) Other changes: C...IMAP POP3 SMTP Component for .NET C#, VB.NET and ASP.NET: Build 519: Contains source code for IMAP WinForms Client, POP3 WinForms Client, and SMTP Send Mail Client. Setup package for the lib is also included.Liekhus ADO.NET Entity Data Model XAF Extensions: Version 1.1.1: Compiled the latest bits that took care of some of the open issues and bugs we have found thus far.manx: manx data 1.1: manx data 1.1 Updated manx data. Includes language and mirror table data.MEDILIG - MEDICAL LIFE GUARD: MEDILIG 20100325: Download latest release from Sourceforge at http://sourceforge.net/projects/mediligMiniCalendar Web Part: MiniCalendar WebPart v1.8.1: A small web part to display links to events stored in a list (or document library) in a mini calendar (in month view mode). It shows tooltips for t...Mytrip.Mvc: Mytrip.Mvc 1.0.43.0 beta: Mytrip.Mvc 1.0.43.0 beta web Web for install hosting System Requirements: NET 4.0, MSSQL 2008 or MySql (auto create table to database) Mytrip.Mv...NodeXL: Network Overview, Discovery and Exploration for Excel: NodeXL Excel 2007 Template, version 1.0.1.126: The NodeXL Excel 2007 template displays a network graph using edge and vertex lists stored in an Excel 2007 workbook. What's NewThis version fixes...Oxygen Smil Player: OxygenSmilPlayer 1.0.0.1a: Second Alpha UploadPowerAuras: PowerAuras V3.0.0K Beta1: New Auras: Item Name Equipment Slot TrackingPowerExt: v1.0 (Alpha 2): v1.0 (Alpha 2). PowerExt can display information such as assembly name, assembly version, public key etc in Explorer's File Properties dialog.Powershell Scripts for Admins: PowerBizTalk 1.0: BizTalk PowerShelll Module allows you to control : Action Component Start Stop Get Enlist Unenlist Remove Applications x...Refix - .NET dependency management: Refix v0.1.0.75 ALPHA: Latest updated version now supports a remote repository, an implementation of which is supplied as an ASP.NET MVC website.Resonance: TrainNode Service Beta: Train Node Service binary setup packageSCSM Incident SLA Management: SCSM Incident SLA Management Version 0.2: This is the first release of the SCSM SLA Management solution. It is an 'beta' release and has only been tested by the developers on the project. T...secs4net: Release 1.01: Remove System.Threading.dll(Rx included) dependence. SML releated function was move out.SharePoint 2010 Managed Metadata WebPart: Taxonomy WebPart 0.0.2: Applied fix to support Managed Metadata fields that allow multiple values.SharePoint 2010 Taxonomy Import Utility: TaxonomyBuilder Version 1: Initial ReleaseThis release includes full XML to Term Store import capabilities. See roadmap for more information. Please read release license prio...SharePoint Geographic Data Visualizer: Source Code: Source CodeSOAPI - StackOverflow API Parser/Wrapper Generator: SOAPI Beta 1: Beta 1 release. API parser/generator, JavaScript, C#/Silverlight wrapper libraries. Up to the hour current generated files can be found @ http://s...SSIS Expression Editor & Tester: Expression Editor and Tester: Initial release of expression editor tool and editor control. Download and extract the files to get started, no install required.STS Federation Metadata Editor: Version 0.1 - Initial release: This is the initial release of the editor. It contains all the basic functionallity but doesn't support multiple contact persons and multiple langu...SuperSocket: SuperSocket(0.0.1.53867): This release fixed some bugs and added a new easy sample. The source code of this release include: Source code of SuperSocket A remote process c...thinktecture Starter STS (Community Edition): StarterRP v1.1: Cleaned up version with identity delegation sample (in sync with StarterSTS v1.1)thinktecture Starter STS (Community Edition): StarterSTS v1.1: New stable version. Includes identity delegation support.VCC: Latest build, v2.1.30609.0: Automatic drop of latest buildWatermarker.NET: 0.1.3812: Stability fixWouter's SharePoint Demo Land: Navigation Service with WCF Proxy: A SharePoint 2010 Service Application that uses WCF service proxies to relay commands to the actual service.Xna.Extend: Xna.Extend V1.0: This is the first stable release of the Xna.Extend Library. Source code and Dynamic Link Libraries (DLLs) are available with documentation. This ve...Yet Another GPS: YaGPS Beta 1: Beta 1 Release Fix Installer Default Folder Fix Sound Language Folder Problem Fix SIP Keyboard Focus Error Add Arabic Sound Language Add Fr...Most Popular ProjectsWBFS ManagerRawrAJAX Control ToolkitMicrosoft SQL Server Product Samples: DatabaseSilverlight ToolkitWindows Presentation Foundation (WPF)patterns & practices – Enterprise LibraryPHPExcelMicrosoft SQL Server Community & SamplesASP.NETMost Active ProjectsCommunity Forums NNTP bridgepatterns & practices – Enterprise LibraryjQuery Library for SharePoint Web ServicesRhyduino - Arduino and Managed CodeBlogEngine.NETNB_Store - Free DotNetNuke Ecommerce Catalog ModuleMediaCoder.NETAndrew's XNA Helperssmark C# LibraryRawr

    Read the article

  • How to add new filters to CAML queries in SharePoint 2007

    - by uruit
    Normal 0 21 false false false ES-UY X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} One flexibility SharePoint has is CAML (Collaborative Application Markup Language). CAML it’s a markup language like html that allows developers to do queries against SharePoint lists, it’s syntax is very easy to understand and it allows to add logical conditions like Where, Contains, And, Or, etc, just like a SQL Query. For one of our projects we have the need to do a filter on SharePoint views, the problem here is that the view it’s a list containing a CAML Query with the filters the view may have, so in order to filter the view that’s already been filtered before, we need to append our filters to the existing CAML Query. That’s not a trivial task because the where statement in a CAML Query it’s like this: <Where>   <And>     <Filter1 />     <Filter2 />   </And> </Where> If we want to add a new logical operator, like an OR it’s not just as simple as to append the OR expression like the following example: <Where>   <And>     <Filter1 />     <Filter2 />   </And>   <Or>     <Filter3 />   </Or> </Where> But instead the correct query would be: <Where>   <Or>     <And>       <Filter1 />       <Filter2 />     </And>     <Filter3 />   </Or> </Where> Notice that the <Filter# /> tags are for explanation purpose only. In order to solve this problem we created a simple component, it has a method that receives the current query (could be an empty query also) and appends the expression you want to that query. Example: string currentQuery = @“ <Where>    <And>     <Contains><FieldRef Name='Title' /><Value Type='Text'>A</Value></Contains>     <Contains><FieldRef Name='Title' /><Value Type='Text'>B</Value></Contains>   </And> </Where>”; currentQuery = CAMLQueryBuilder.AppendQuery(     currentQuery,     “<Contains><FieldRef Name='Title' /><Value Type='Text'>C</Value></Contains>”,     CAMLQueryBuilder.Operators.Or); The fist parameter this function receives it’s the actual query, the second it’s the filter you want to add, and the third it’s the logical operator, so basically in this query we want all the items that the title contains: the character A and B or the ones that contains the character C. The result query is: <Where>   <Or>      <And>       <Contains><FieldRef Name='Title' /><Value Type='Text'>A</Value></Contains>       <Contains><FieldRef Name='Title' /><Value Type='Text'>B</Value></Contains>     </And>     <Contains><FieldRef Name='Title' /><Value Type='Text'>C</Value></Contains>   </Or> </Where>     The code:   First of all we have an enumerator inside the CAMLQueryBuilder class that has the two possible Options And, Or. public enum Operators { And, Or }   Then we have the main method that’s the one that performs the append of the filters. public static string AppendQuery(string containerQuery, string logicalExpression, Operators logicalOperator){   In this method the first we do is create a new XmlDocument and wrap the current query (that may be empty) with a “<Query></Query>” tag, because the query that comes with the view doesn’t have a root element and the XmlDocument must be a well formatted xml.   XmlDocument queryDoc = new XmlDocument(); queryDoc.LoadXml("<Query>" + containerQuery + "</Query>");   The next step is to create a new XmlDocument containing the logical expression that has the filter needed.   XmlDocument logicalExpressionDoc = new XmlDocument(); logicalExpressionDoc.LoadXml("<root>" + logicalExpression + "</root>"); In these next four lines we extract the expression from the recently created XmlDocument and create an XmlElement.                  XmlElement expressionElTemp = (XmlElement)logicalExpressionDoc.SelectSingleNode("/root/*"); XmlElement expressionEl = queryDoc.CreateElement(expressionElTemp.Name); expressionEl.InnerXml = expressionElTemp.InnerXml;   Below are the main steps in the component logic. The first “if” checks if the actual query doesn’t contains a “Where” clause. In case there’s no “Where” we add it and append the expression.   In case that there’s already a “Where” clause, we get the entire statement that’s inside the “Where” and reorder the query removing and appending elements to form the correct query, that will finally filter the list.   XmlElement whereEl; if (!containerQuery.Contains("Where")) { queryDoc.FirstChild.AppendChild(queryDoc.CreateElement("Where")); queryDoc.SelectSingleNode("/Query/Where").AppendChild(expressionEl); } else { whereEl = (XmlElement)queryDoc.SelectSingleNode("/Query/Where"); if (!containerQuery.Contains("<And>") &&                 !containerQuery.Contains("<Or>"))        {              XmlElement operatorEl = queryDoc.CreateElement(GetName(logicalOperator)); XmlElement existingExpression = (XmlElement)whereEl.SelectSingleNode("/Query/Where/*"); whereEl.RemoveChild(existingExpression);                 operatorEl.AppendChild(existingExpression);               operatorEl.AppendChild(expressionEl);                 whereEl.AppendChild(operatorEl);        }        else        {              XmlElement operatorEl = queryDoc.CreateElement(GetName(logicalOperator)); XmlElement existingOperator = (XmlElement)whereEl.SelectSingleNode("/Query/Where/*");                 whereEl.RemoveChild(existingOperator);               operatorEl.AppendChild(existingOperator);               operatorEl.AppendChild(expressionEl);                 whereEl.AppendChild(operatorEl);         }  }  return queryDoc.FirstChild.InnerXml }     Finally the GetName method converts the Enum option to his string equivalent.   private static string GetName(Operators logicalOperator) {       return Enum.GetName(typeof(Operators), logicalOperator); }        Normal 0 21 false false false ES-UY X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} Normal 0 21 false false false ES-UY X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} This component helped our team a lot using SharePoint 2007 and modifying the queries, but now in SharePoint 2010; that wouldn’t be needed because of the incorporation of LINQ to SharePoint. This new feature enables the developers to do typed queries against SharePoint lists without the need of writing any CAML code.  But there is still much development to the 2007 version, so I hope this information is useful for other members.  Post Normal 0 21 false false false ES-UY X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} written by Sebastian Rodriguez - Portals and Collaboration Solutions @ UruIT

    Read the article

< Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >