views:

296

answers:

1

I'm trying to use Report Builder 2.0 to query a Sharepoint List using an XML data source. I explicitly list the fields I want returned because otherwise I don't get all of them, due to some of them being null sometimes. However, one of the fields I need has a space in its name. If I do a query where I don't explicitly specify fields, I get this back as one of the fields: ows_Pre-Req Estimate. How can I specify this field in the ElementPath tag? I get different errors when I try to put the field name in quotes or just leave it with a space as shown:

<ElementPath IgnoreNamespaces="true">
GetListItemsResponse/GetListItemsResult/listitems/data/row{@ows_Release,@ows_Theme,@ows_ID,@ows_Pre-Req Estimate}
</ElementPath>

Here's the error I get when I leave the space in and try to run the query in Query Designer:

The XmlDP query is invalid. Syntax error at line 1, character 105 of the ElementPath. Expected }.

I tried checking the MSDN page about ElementPath but didn't see any notes about fields with spaces. I saw on Maria's two cents that someone suggested using _x0020_ instead of a space but that doesn't seem to work either.

Cross-posted to Microsoft Forums.

A: 

Ooh, here's some hairiness. All right, so the commenter on Maria's Two Cents was right: you can escape a space in ElementPath with _x0020_. My problem was that you have to escape the hyphen in the field name, too. I downloaded Report Builder 3.0 and tried creating the query in it. Afterward, editing the XML of the query showed me the field names as they ought to be encoded:

<FieldRef Name="Pre_x002d_Req_x0020_Estimate" />

I can now use this in Report Builder 2.0 (note the "ows_" in front of the field names):

<ElementPath IgnoreNamespaces="true">
GetListItemsResponse/GetListItemsResult/listitems/data/row{@ows_Release,@ows_Theme,@ows_ID,@ows_Pre_x002d_Req_x0020_Estimate}
</ElementPath>
Sarah Vessels