Comments (4)
here is the caml query i got the first time
caml query : <View Scope="RecursiveAll"><ViewFields><FieldRef Name="ID" /><FieldRef Name="Created" /></ViewFields><RowLimit Paged="TRUE">10</RowLimit><Query> <Where><And><Geq><FieldRef Name="Created" /><Value IncludeTimeValue="True" Type="DateTime">2008-12-31T15:00:00.000Z</Value></Geq><Leq><FieldRef Name="Created" /><Value IncludeTimeValue="True" Type="DateTime">2020-01-01T16:00:00.000Z</Value></Leq></And></Where></Query></View>
here is the one i got a second time
caml query : <View Scope="RecursiveAll"><ViewFields><FieldRef Name="ID" /><FieldRef Name="Created" /></ViewFields><RowLimit Paged="TRUE">10</RowLimit><Query> <Where><And><And><Geq><FieldRef Name="Created" /><Value IncludeTimeValue="True" Type="DateTime">2008-12-31T15:00:00.000Z</Value></Geq><Leq><FieldRef Name="Created" /><Value IncludeTimeValue="True" Type="DateTime">2020-01-01T16:00:00.000Z</Value></Leq></And></And></Where></Query>
note the extra opening and closing And that made the caml query invalid.
from camljs.
might be related to #14
from camljs.
Thanks for reporting, will look into this soon!
from camljs.
Issue happens because CamlBuilder is stateful, so you cannot really reuse it to produce several queries, rather, you would need to create a new CamlBuilder for each query. So after you call ToString()
or ToCamlQuery()
, the builder shouldn't be used anymore.
So what happened in your particular case, you essentially did something like this:
new CamlBuilder()
.View(["ID", "Created"])
.RowLimit(pageSize, true)
.Scope(CamlBuilder.ViewScope.RecursiveAll).Query().Where()
.All(this.expressions)
.All(this.expressions) // notice the second "All", this is of course invalid
.ToString();
For now, I am planning to add a check so that people aren't getting confused and will get some human-friendly error message instead of silently getting a potentially incorrect query.
There's of course an option to make a deep copy of the state every time when returning the object in every chain call, but it is quite bad for performance.
from camljs.
Related Issues (20)
- Error: Cannot read property 'create' of undefined HOT 13
- Please update nuget packages HOT 1
- ContentTypeId Field HOT 3
- Chrome Extension HOT 4
- Bug with .toString() HOT 1
- FromXml doesn't work in node environments HOT 4
- OrderBy Descending is setting CAML Query to Ascending="False", should be Ascending="FALSE" HOT 7
- Please add methods after CamlBuilder.FromXml HOT 2
- ie browser cannot use this lib HOT 3
- Missing Lookup value type HOT 1
- DateTime query not including IncludeTimeValue HOT 1
- Support ToString() when page is loading HOT 2
- BooleanField gets improperly translated to Integer field HOT 2
- Create CAML from Object HOT 1
- xmldom vulnerability should be addressed HOT 1
- How to use pagination? HOT 1
- CamlBuilder TypeScript Generic
- Build dynamic CAML with dynamic filters
- Allow to clone expressions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from camljs.