Hi,
Neither of these queries compile:
SELECT * FROM [cq:PageContent] AS n WHERE ISDESCENDANTNODE(n, [$sitePath])
SELECT * FROM [cq:PageContent] AS n WHERE ISDESCENDANTNODE(n, $sitePath)
Am I missing something here?
Thanks.
Solved! Go to Solution.
Views
Replies
Total Likes
This statement is a string, you may have to perform string operations
statement =" SELECT * FROM [cq:PageContent] AS n WHERE ISDESCENDANTNODE(n, " + $sitePath + ")";
you need to replace $sitePath with your variable.
Views
Replies
Total Likes
This statement is a string, you may have to perform string operations
statement =" SELECT * FROM [cq:PageContent] AS n WHERE ISDESCENDANTNODE(n, " + $sitePath + ")";
you need to replace $sitePath with your variable.
Views
Replies
Total Likes
Maybe you can do like this
String expression = "
SELECT * FROM [cq:PageContent] AS n WHERE ISDESCENDANTNODE(n, $sitePath)"; // as aboveString sitePath= ...QueryManager queryMgr = session.getWorkspace().getQueryManager();Query query = queryMgr.createQuery(expression,Query.JCR_SQL2);query.bindValue("sitePath",sitePath);QueryResult result = query.execute();
Views
Replies
Total Likes
Here is a great resource for the JCR SQL2 query syntax:
Views
Replies
Total Likes