I know there are currently some bugs in how prepend is working. Try adding prepend to the first isNotNull section also. For some reason it seems you have to prepend="and" to places where you wouldn't think it would be needed.

Michael Schall wrote:
I have the following code and does not work.  Is this a bug or am I
not understanding how the prepend should work?  I get a "sql error
near tp_Calls".  The prepends aren't adding in the "and" to the
resultant sql string.

<dynamic prepend="WHERE">
    <![CDATA[
      OffHookDt <= #EndDate# AND
      OffHookDt >= #StartDate#
    ]]>
    <isNotNull property="LocationCode">
        <isNotEqual prepend="and" property="LocationCode" compareValue="%">
            tp_Calls.LocationCd = #LocationCode#
        </isNotEqual>
    </isNotNull>
    <isNotEqual prepend="and" property="RateType" compareValue="-1">
        RateType = #RateType#
    </isNotEqual>
    <isEqual prepend="and" property="PrivateAllowed" compareValue="0">
        tp_Calls.Hidden = 0
    </isEqual>
</dynamic>

If I change it to the following everything works great.

<dynamic prepend="WHERE">
    <![CDATA[
      OffHookDt <= #EndDate# AND
      OffHookDt >= #StartDate#
    ]]>
    <isNotNull  property="LocationCode">
        <isNotEqual property="LocationCode" compareValue="%">
            and tp_Calls.LocationCd = #LocationCode#
        </isNotEqual>
    </isNotNull>
    <isNotEqual property="RateType" compareValue="-1">
        and RateType = #RateType#
    </isNotEqual>
    <isEqual property="PrivateAllowed" compareValue="0">
        and tp_Calls.Hidden = 0
    </isEqual>
</dynamic>

Mike


Reply via email to