Geeks With Blogs

Tangible Thoughts SharePoint, MOSS? and all the other questions

Once upon a time (not very long ago to be quite honest) I thought it would pretty neat if there were a Parser that could convert conditions written in natural language to CAML.

What I wanted was a parser that could convert something like this

(Column1 = Test) | (Column2 = JohnDoe)





                                    <FieldRef Name=”Column1”/>

                                    <Value Type=”Text”>Test</Value>



                                    <FieldRef Name=”Column2”/>

                                    <Value Type=”Text”>JohnDoe</Value>




Reyns post showed a lot of potential; however it wasn’t all the way there. So I had to break in Visual Studio.

You can view the results of my effort here. It converts the expression to postfix in order to convert it to CAML

I need to make the following additions to Reyns code.

But now I feel this is really impractical. The problem being that, CAML by nature allows only binary operations so it becomes a quite a bit cumbersome to write ( Condition1 | ( Condition2 & (Condition 3 | Condition 5) ) )

Well if that doesn’t look too complicated try this

( (X=5) | ( (Y=2) & ((N=True) | Modified=True) ) )

^ by just looking at it you have no clue what it’s supposed to do. An attempt at user-friendliness down the drain. It only saves you the trouble of writing in all those Caml Tags.

But the nice point about it is, I actually do [Today] Processing, and not just today, but stuff like ‘[Today,5]’ or ‘[Today,-5]’ etc.

Posted on Monday, February 7, 2005 9:17 AM SharePoint | Back to top

Comments on this post: NLP CAML Parser?

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Tariq | Powered by: