How to use Joins in queries in js files

Avatar

Avatar
Validate 1
Level 1
kattyice
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
kattyice
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
kattyice
Level 1

05-03-2020

Hi there,

 

I am trying to query data from javascript like below:

 

var query = NLWS.xtkQueryDef.create(
  {queryDef: {schema: "nms:recipient", operation: "select", 
    select: {
        node: [{expr: "@id"},
               {expr: "@label"},
               {expr: "@internalName"}] 
    }, 
    where: {
      condition: [{expr: "@id='16'"}]
    }
  }})

 

So for the above query, if I have another table which is nms:userEmail. And I want to inner join this table with the current one(which is the one that shows above in the js code(nms:recipient)), and get the joined table. How can I do that here? What the query should be like?

 

Thank you!

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 3
jonasn92134656
Level 3

Likes

28 likes

Total Posts

38 posts

Correct reply

8 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 3
jonasn92134656
Level 3

Likes

28 likes

Total Posts

38 posts

Correct reply

8 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
jonasn92134656
Level 3

06-03-2020

Hi,

 

Is the join defined in the schema already? In that case you should be able to reference attributes of the linked schema in the query, either in selected nodes or conditions:

 

var query = NLWS.xtkQueryDef.create(
  {queryDef: {schema: "nms:recipient", operation: "select", 
    select: {
        node: [{expr: "@id"},
               {expr: "@label"},
               {expr: "@internalName"},
{expr: "linkToOtherResource/@linkedAttribute"}] }, where: { condition: [{expr: "@id='16'"}] } }})

 

Regards

Answers (0)