Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

odata uri help

I have a large report to monitor actuals in Project Online timesheets and MS Project data. Due to the various joins required in the tables to provide the information I need to visualise in the report, refreshing the data sometimes causes errors. To rectify this, I'm attempting to incorporate filters on the OData queries before the data is brought into the query editor. I'm having trouble with the following one though (I've replaced our tenant name below with <tenantname>). Essentially, I want to bring in the following data:

Table: Resources
Columns: ResourceId, ResourceName
Filters:
Role does not equal "Ex-RD" or "NPI"
TypeName = "Work Resource" (or ResourceType = "2")

 

I've tried the following:

https://<tenantname>.sharepoint.com/sites/pwa/_api/projectdata/Resources?$select=ResourceId,ResourceName&$filter=ResourceIsGeneric eq 'FALSE' and ResourceIsActive eq 'TRUE' and Role ne 'Ex-RD' or 'NPI' and TypeName eq 'Work Resource'

 

 

The above causes this error (the same error is produced with variations of the filtering but the last word is 'and' / 'or'):

Odata error 2.PNG


I've tried the following variations:

...$filter=ResourceIsGeneric eq FALSE and ResourceIsActive eq TRUE and Role ne 'Ex-RD' or 'NPI' and ResourceType eq 2

...$filter=ResourceIsGeneric ne 'TRUE' and ResourceIsActive ne 'FALSE' and Role ne 'Ex-RD' or 'NPI' and TypeName eq 'WorkResource'

...$filter=ResourceIsGeneric ne TRUE and ResourceIsActive ne FALSE and Role ne 'Ex-RD' or 'NPI' and TypeName eq 'WorkResource'

 

 

This one does work:

...$filter=Role ne 'Ex-RD' and Role ne 'NPI' and TypeName eq 'Work Resource'

 

But as soon as I add one of the boolean fields (ResourceIsActive/ResourceIsGeneric), or try to combine the two Role filters together, I get the error again.

1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

These two articles could help. odata-filter-tips-tricks and odata-version-2-0/uri-conventions.

It seems the Boolean type are treated as true and false, but not as strings. You can try this one:

https://<tenantname>.sharepoint.com/sites/pwa/_api/projectdata/Resources?$select=ResourceId,ResourceName&$filter=ResourceIsGeneric eq false and ResourceIsActive eq true and Role ne 'Ex-RD' and Role ne 'NPI' and TypeName eq 'Work Resource'

Best Regards!

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

Could you please mark the proper answer as solution or share the solution if it's convenient for you? That will be a big help to the others.

 

 

Best Regards!
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

These two articles could help. odata-filter-tips-tricks and odata-version-2-0/uri-conventions.

It seems the Boolean type are treated as true and false, but not as strings. You can try this one:

https://<tenantname>.sharepoint.com/sites/pwa/_api/projectdata/Resources?$select=ResourceId,ResourceName&$filter=ResourceIsGeneric eq false and ResourceIsActive eq true and Role ne 'Ex-RD' and Role ne 'NPI' and TypeName eq 'Work Resource'

Best Regards!

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.