Robell_Liu
Robell_Liu

Reputation: 1

.where(Scope.ChildrenMeAndDown="Scope:2947538"): is not recognized by python rest API

I found the "Scope**.**ChildrenMeAndDown" is not recognized by Python rest API in the "where" function .

for s in v1.Story.select('Number','Name', 'Scope',
                               'Status','Estimate', 'Owners',
                                'Timebox' ,'Team' ,'Parent',
                                'CreatedBy','CreateDateUTC','ChangeDateUTC',
                                'Reference' ,
                              ).where(Scope.ChildrenMeAndDown="Scope:2947538"):

SyntaxError: keyword can't be an expressionstrong text

Upvotes: 0

Views: 153

Answers (2)

Mike
Mike

Reputation: 136

I had to play around with REST HTML hierarchical queries for a while to get this to work. In the below example I wanted the Parent and Child scopes. I first tried ChildrenAndMeDown but it returned the Parent and Grandparent Scopes. So I tried the counter-intuitive approach, ParentMeAndUp, which retrieved the desired Parent and Child Scopes.

Example Hierarchy:   
  GrandparentScope
      ParentScope
        ChildScope
        ChildScope
        ChildScope

Below is my Query which correctly returned the Parent and Child Scopes...

https://V1/Data/Story?Sel=Number,Name,Scope.Name&Where=Scope.ParentMeAndUp.Name="ParentScope"

Upvotes: 1

user
user

Reputation: 1

I am not sure what's the exact reason, even I faced the similar problem and then used filter.

For your example try following code:

for s in (v1.Story.filter("Scope.Name='2947538'").select('Number','Name', 'Scope','Status','Estimate', 'Owners','Timebox' ,'Team' ,'Parent','CreatedBy','CreateDateUTC','ChangeDateUTC','Reference' ,)): print s.Number

Upvotes: 0

Related Questions