Query string value in Where Condition

Sam Power asked on September 2, 2014 05:13

Hi,

I am trying to check a query string value in a where condition.

If I make the where condition the following I get the desired result. 'NodeParentID = 22'

If I make the condition the following it doesn't work even though the query string parameter node-id is definitely being passed through (And has a value of 22) 'NodeParentID = {? node-id ?}'

How do I accomplish this?

Thanks, Sam

Correct Answer

Brenden Kehren answered on September 3, 2014 07:16

If you're trying to use the query string macro, you need to ensure your macro doesn't have any spaces in it. {% NodeID %} will not work and is different than the correct {%NodeID%}. Also make sure you are using the Macro editor (black arrow to the left of the textbox). In there enter NodeParentID = {%NodeID%}. If you enter this directly in the textbox, it may not render properly.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Ali Heristchian answered on September 2, 2014 07:17

Hi,
Do you exactly type 'NodeParentID = {% node-id %}' in Where Condition of Webpart? If so, you must use like this NodeParentID='{%node-id%}'

0 votesVote for this answer Mark as a Correct answer

Sam Power answered on September 2, 2014 09:35

Adding the apostrophes didn't work. Which kind of makes sense since when I manually enter the 22 I don't use apostrophes.

0 votesVote for this answer Mark as a Correct answer

Sam Power answered on September 2, 2014 09:59 (last edited on December 10, 2019 02:30)

The following worked:

NodeParentID={%QueryString["node-id"]|(identity)GlobalAdministrator%}

0 votesVote for this answer Mark as a Correct answer

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