Post

3 followers Follow
0
Avatar

Get Group members using CZQL

Hello,

I'm trying to get the list of Groups (User Groups and Discussion Groups), and the members (Users) of each group. I'm Using API 2.0, with CZQLQuery.

I tried to adapt what is described in https://success.clarizen.com/hc/en-us/community/posts/203993338-Using-Link-Entity-in-query

 

The following request works:

SELECT @Container, Member
FROM GroupMembershipLink
LIMIT 1000

 

but not this one (this request should be similar from the one in the above link):

SELECT @Container.Name, Member.Name
FROM GroupMembershipLink
LIMIT 1000

I get the error "Invalid Query: Invalid CZQL (1:-1)"

 

What am I doing wrong?

Thanks in advance for your help,

Armand

Armand BOLMONT Answered

Please sign in to leave a comment.

4 comments

0
Avatar

Hi Armand,

Just drop the @ before Container. It worked for me.
The @ is rarely required to distinguish between reserved words and field names, but as your field name is 'nested' you can do without it.

Hope this helps,

Ophir

Ophir Kenig 0 votes
Comment actions Permalink
0
Avatar

Hi Ophir,

 

Thanks it worked for me too. As the @ was mandatory for reserved keywords, I assumed it was a best practice to use it every time. 

By chance, do you have any specific advice about when to use @, and when not to use it?

From my experience, I would say:

- use @ on direct fields

- don't use @ on nested fields

 

Do you agree, is there more specific cases?

Thanks again for your help, I'm glad you're still around, as I saw you already helped a lot of people here!

Armand BOLMONT 0 votes
Comment actions Permalink
0
Avatar

Hi Armand and thanks for the compliments...

I have no recommendations additional to the ones you already mentioned. 

I haven't fully explored the features and tweaks of the CZQL parser so there may be other edge cases, but I believe it would be easier to tackle them if and when we come across them.

Hope this helps,

Ophir

Ophir Kenig 0 votes
Comment actions Permalink
0
Avatar

I'll go with these guidelines and see if there are other edge cases. I know now that the @ isn't just an escape for reserved keyword.

 

Thanks for you support!

Armand BOLMONT 0 votes
Comment actions Permalink