Get current node ID

Shawn Ebeyer asked on January 11, 2016 22:29

Hi guys,

I'm trying to filter out some data by using a WHERE condition inside a repeater and can't figure out the syntax.

Here's the logic I need to use:

Get all data EXCEPT the current document.

So I'm trying things like NodeID <> CurrentNodeID in the Where condition but it's not working.

So something like WHERE: The Node ID does not equal the CURRENT node ID.

Any help with specific syntax would be amazing.

Thanks in advance,

Shawn

Recent Answers


Laura Frese answered on January 11, 2016 22:56 (last edited on January 11, 2016 22:58)

DocumentNodeID != {% CurrentDocument.DocumentNodeID %}

To see what macros are available, click on the black triangle next to the where condition to open up the macro dialog. On the bottom click the {#} and you will see a list of available macros. For a brief tutorial on macros check out this blog post

0 votesVote for this answer Mark as a Correct answer

Shawn Ebeyer answered on January 11, 2016 23:10

Thanks Laura,

I've put that line in my Where condition but unfortunately it is not working. Any idea what I'm doing wrong?

Meanwhile, I will take a look at the blog post.

Thank you again,

Shawn

0 votesVote for this answer Mark as a Correct answer

Laura Frese answered on January 12, 2016 00:28

Are you getting any kind of error, can you show a screen shot of how it is entered into the web part?

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on January 17, 2016 15:27 (last edited on January 17, 2016 15:28)

Can you try this? DocumentNodeID <> {% CurrentDocument.DocumentNodeID %}

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.