Greater Than And Less Than Filter

3 posts, 0 answers
  1. Trevor
    Trevor avatar
    13 posts
    Member since:
    Jun 2011

    Posted 07 May 2012 Link to this post

    I have an Open Access data source which gives me an error when I try to combine two conditions on the same field. I need to filter to only projects which have a status >=25 and <=40

    line 1:132: unexpected char: '@'
    Original Query: DEFINE EXTENT xt FOR SQ.OpenAccess.Project; SELECT * FROM xt AS this WHERE this.Rep == $1 AND this.Status >= $2 AND this.Status <= @Status

    Here is the code which was generated by the wizard.

    <telerik:OpenAccessDataSource ID="OpenAccessDataSource1" runat="server"
         ObjectContextProvider="SQ.OpenAccess.EntitiesModel, SQ.OpenAccess"

    onselecting="OpenAccessDataSource1_Selecting" TypeName="SQ.OpenAccess.Project"
     
    Where="this.Rep == @Rep AND this.Status &gt;= @Status AND this.Status &lt;= @Status">
    <whereparameters>
    <asp:QueryStringParameter DefaultValue="1" Name="Rep"  QueryStringField="USERID" />
    <asp:QueryStringParameter DefaultValue="25" Name="Status"  QueryStringField="MInStatus" />
    <asp:QueryStringParameter DefaultValue="40" Name="Status"  QueryStringField="MaxStatus" />
    </whereparameters>
    </telerik:OpenAccessDataSource>
  2. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 08 May 2012 Link to this post

    Hello Trevor,
    It looks like, because you are using the same variable name twice, we are not able to match it correctly. Can you try to use Status1 and Status2?

    Regards,
    Jan Blessenohl
    the Telerik team
    Follow @OpenAccessORM Twitter channel to get first the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
  3. DevCraft banner
  4. Trevor
    Trevor avatar
    13 posts
    Member since:
    Jun 2011

    Posted 08 May 2012 Link to this post

    That worked, Thanks.  Here is the working code.
    Where="this.Rep == @Rep AND this.Status >= @Status1 AND this.Status <= @Status2">
          <whereparameters>
              <asp:QueryStringParameter DefaultValue="1" Name="Rep"
                  QueryStringField="USERID" />
              <asp:QueryStringParameter DefaultValue="25" Name="Status1"
                  QueryStringField="MinStatus" />
                  <asp:QueryStringParameter DefaultValue="40" Name="Status2"
                  QueryStringField="MaxStatus" />
          </whereparameters>
Back to Top