Loading...

CAML filter for white space

CAML filter for white space

  • This topic is empty.
Viewing 3 reply threads
  • Author
    Posts
    • #4864
      Anonymous
      Anonymous
      Participant

      Hi

      One way to get around this is to use Calculated Column with formatting rule for the Body column. My suggestion is to use the formmating runction TRIM for the Calculated column on Body column. White space including new line character can be removed allowing the CAML filter to check on the Calculated column.

      1. Create a Calculated Column "Body2" with formmatting: =TRIM([Body])
      2. Use CAML Filter on Calcualted Column
      <IsNotNull><FieldRef Name="Body2"/></IsNotNull>

      Let me know if this helps.
      Thanks,

    • #3833
      Anonymous
      Anonymous
      Participant

      This might be a CAML question or maybe just a web part configuration question. I have a list field (Body) that I would like to use as a filter so that I display only those list items that have content in the “Body” field. I have created a CAML filter that says <IsNotNull> <FieldRef Name=”Body” /> </IsNotNull> The problem is that the some of the body fields contain a carriage return only in that field so it displays as it would if there were other content in it. Does anyone know of a way to filter out the white-space so that I only get valid list items with content?

    • #7251
      Anonymous
      Anonymous
      Participant

      – thanks very much for this tip! I can see this coming up many times in the future and I am glad to here that there is a good trim function available.

    • #4866
      Anonymous
      Anonymous
      Participant

      test response

Viewing 3 reply threads

You must be logged in to reply to this topic.