Setting a TextFilter's value from a Query String (URL) Filter - sharepoint

I'd like to start off by saying I'm very new to Sharepoint, so I'm sorry if I'm asking something very obvious. I've done quite a bit a googling and can't find an answer to my question. This leads me to believe that maybe I'm asking the wrong question. So, here goes:
We have a Sharepoint webpage that currently contains 3 Web Parts (2 lists and a text filter). The text filter can be used to filter the two lists. I've been asked to provide the following functionality:
A user must be able to open this page from an http link (easy)
The Text-Filter must be automatically filled-in and applied, thus immediately filtering the two lists
This seemed pretty straight-forward to me: Pull a parameter from the page's URL and feed it into the filter.
I found and added a Query String (URL) Filter and I managed to pull the parameter from the URL, but I can't feed it to the existing Filter!
Sure, I can pass the value to the two lists (effectively coding the same filter two different ways) but that seems wrong. So, my question boils down to this:
Is it possible to set a Text Filter's value from a Query String (URL) Filer?
Am I asking the wrong question? Am I looking at this problem in the wrong way? Any help is much appreciated, thanks.

I was asking the wrong question!
It seems you can set a Text Filter's value on page-load through the URL. Here's how:
http://sharepoint-server/site/subsite/project/default.aspx?Text%20Filter%20Name=999
Where Text%20Filter%20Name is the name of your Text Filer (in this case, with spaces in the name), and where 999 is the value you're passing to the filter.

Related

How to detect change in the URL - Dart/Flutter

I'm trying to fetch a specific part from the youtube URL. For example:- if the user has put the following URL https://www.youtube.com/watch?v=KOjE7cQ0FkA
I would fetch the following part KOjE7cQ0FkA using the below method
String url = urlController.text; // https://www.youtube.com/watch?v=KOjE7cQ0FkA
List urlList = url.split("=");
String urlCode = await urlList[1];
but sometimes people copy the video link from mobile and this is how it would appear
https://youtu.be/KOjE7cQ0FkA In such case, above code wouldn't work
So how can I detect which URL is put by the user and perform a split operation accordingly
Sorry, if my question sounds stupid but I hope you got an idea that what I'm trying to achieve here
There are many ways to approach this. One way would be to parse the URL (have a look at this SO question).
With this approach you could check if the query parameter watch is present -- if not the URL is probably in the mobile format.
Another approach would be to define a regex expression for the Video-ID (KOjE7cQ0FkA) part of the URL. That way you can extract the Video-ID regardless of the format of the URL. I would probably go with that approach.
Your regex could look like this: ([a-zA-Z]+(\d[a-zA-Z]+)+)
I used this site to create the regex. You probably need to modify it a little bit. Also if the ID has a fixed length that is a great criteria to filter by.

Find Elements with dynamic id's and Xpaths's

I apologize if this is a duplicate of a question already but nothing I read seemed to do the trick.
I am trying to automate the process of adding my hours for my job. This entails using selenium to mimic the process I do to enter the hours for me.
The problem is, as I navigate through the process, I have run into an instance where one of the elements has a dynamic id and xpath (any maybe other things. I am not very proficient in HTML).
I need to select the "Day" button on the "View" drop down. The highlighted HTML corresponds to that button. I have already checked and both the ID and Xpath change every time I create a new session. I usually do the following to find my elements:
elem = driver.find_element_by_xpath('xpath')
Below is the xpath I currently see:
//*[#id="ab5378a9418345a2a57ad12f066127a6"]
To further complicate things, the xpath for the "Week" selection is the following:
//*[#id="741015164c5547fbb5403c03c46636d3"]
I tried to figure out how to use "contains" with the xpath but even so, the two are not different enough to differentiate by using "#id". The only constant thing and difference I see each time is that the
data-automation-label="Day"
is present on the day element and
data-automation-label="Week"
is present on the week element.
Does anyone have any experience finding the elements when a problem like such occurs? I am working in Python3.6 on a windows 7 computer.
Again, I apologize if this is a duplicate but I tried very hard to find an answer before coming here for help.
Thanks in advance!
You can use two of the below possible selectors
XPATH
//div[#data-automation-label="Day"]
CSS
div[data-automation-label="Day"]
When you use identifier your main focus should be how to find something that is unique to that object. And it really doesn't matter if it is name or id or what not. Use what you think would work the best. And here data-automation-label implies that itself

Search Algorithm for a web application that needs to look for a specific value

I'm developing a webapp that will need to download the html form a website and then iterate through the code and try to find a specific but ever changing value (in our case it will be the price for the product).
For this, I was thinking about asking the user (upon installation and setup) to provide the system with a few lines of html from the page (that has the price) and then from then on, every time we need to fetch the price we would try to search for those lines and find the price.
Now, I believe this is a horrible and slow way of doing this and since there are no rules and the html can be totally different from one website to another (even the same website might change) I couldn't find a better way.
One improvement that I thought about was to iterate through the first time and record the line at which we find the code. Once found, the subsequent times we would then start from a few lines before the expected location and start the search. Any Thoughts on how I can improve on this?
I posted this question on https://cstheory.stackexchange.com/ but they commented that it's not on topic and that I should post it here.
I have the code for the above and if needed I can post it, I'm simply thinking that there must be a better, faster way of doing this.
This is actually something I tried for a project recently (using BeautifulSoup and Python). The solution that worked for me was to workout CSS selectors (which can map to jQuery selectors) that targeted the elements that contained the values I was looking for. In my case I was able to narrow down the full document to just the elements that contained what I was looking for but if you couldn't get exactly what you where after you could combine this with some extra lactic like test to see if it looks like a price (via regex) or test what it is next to.

Custom query string in domino URL

Need a way to pass a value between to pages using URL query strings if possible. However everytime I add "?customquery=customvalue" at the end it ends up to the 404 page of the website.
I want to basically make it look like this.
https://example.com/somedepartment/sample.nsf/page/hello+world?customquery=customvalue
hello+world is a document that is equivalent to a webpage.
I tried this plus a javascript that collects the strings after the number sign and it works.
https://example.com/somedepartment/sample.nsf/page/hello+world#customvalue
However, I couldn't use the hash sign because they told me not to use it and use another unique symbol instead. I am not aware of any symbols that could work the same with hash sign. If there is, please enlighten me.
Apparently, I was able to find an answer.
https://example.com/somedepartment/sample.nsf/page/hello+world?OpenDocument&RandomParam=sample
Now I could pass values by means of this format. Basically it has to be preceded by "OpenDocument" parameter before putting custom ones.
This documentation also helps: http://www.ibm.com/developerworks/lotus/library/ls-Domino_URL_cheat_sheet/

Searching Single Pages with Dynamic Content

I have a slight problem I have been trying to address for a client I have been working with. We have 4 sets of single pages that are loading content from a database using PHP based upon a get string that is provided. These pages that are generated are optimized well for SEO and have alt tags for images and Content that we need to be able to search using a search feature.
Now i had assumed (An everyone knows what assuming gets you) that these pages by default would be able to be searched by the concrete 5 built in search feature. But it doesn't work. If I search for a word that I know is definitely on one of these pages even multiple times no results are found.
How can I make Concrete5 search these pages. If its no do able by a default or by a plugin, then can someone please offer some advice on how to fix this. This is an important feature and must be completed.
EDIT: See my comment below. I still need some help or direction here as CSE inst much of an option.
EDIT2: It may be viable for me to install a crawler and a custom search engine to address my problems. I was thinking of spider. Any other suggestions on that or other options are much appreciated!
Unfortunately C5 doesn't provide a way to do this -- the only way to tap into the search index is with blocks. And even if you created a phony block just to pass content from the single_page through to the search index, there's no way to say that some content is from one URL while other content is from another URL (which you'd need to do since your single_page controller is handling many different URL's).
I don't know of a way to achieve what you want to do (and it appears that nobody else does either -- http://www.concrete5.org/community/forums/customizing_c5/make-content-in-single-pages-searchable/ ), other than building your own internal search engine.
EDIT: I just did some digging, and thought that perhaps you could manually insert records into the PageSearchIndex table and specify the searchable content and the desired path there -- but this won't work because it relies on one cID (collection id, a.k.a. page id) per entry -- so you'd only be able to insert one record for the top-level single_page path.
I think the simplest solution here would be to create your own searching infrastructure for your single_pages (like some kind of function in the controller that would return an array of page paths and searchable content for each one), then override the search block and perform an additional search of your single_page -- then combine the results on the search results page there. Or just use google site search for your site, which will actually crawl the pages and hence find your various single_page urls: https://www.google.com/cse/
Best of luck.
I have not tested this, but maybe you can put a function getSearchableContent() in the single pages controller like you do for blocks. This would return the string to be searched. Would look something like this:
function getSearchableContent() {
// ... compose searchstring depending on the queried content.
return $searchstring;
}
But I don't know if this works for dynamic content. If not, I'd look into C5's search index core classes and try to extend them for your project.

Resources