Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Content Search Query Text IF Statement Syntax

$
0
0

Hi there,

Is there any way within the Query Text section of a Content Search Web Part to do an IF statement?

I am basically wanting to do the following in plain English:

If the query string "cpt" has a value then use that, otherwise use the terms from the search box. Here is what I have so far but this only works for the "cpt" query string and not the SearchBoxQuery.

or(ContentPageType={QueryString.cpt}, {SearchBoxQuery})

1 The following url brings back results as expected - Page.aspx?cpt=News (This works)
2 The following url brings back no results - Page.aspx?k=News (Broken)
3 The following url brings back no results - Page.aspx#k=News (Broken)

N.B. When I just use {SearchBoxQuery} as the query, the urls at 2 and 3 above show the results as expected.

Any ideas?

Thanks in advance


Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>