Filtering a list from inside an item in the same list


Badge +4

Hey all,

after browsing a bit, I couldn't find the answer, but I have no idea how to look for this. (update: I've found a few topics getting close to this issue, but nothing really specific. Also this is not really a Nintex question, more a SharePoint question, sorry for that.)

I've got a list 'security reports', which looks has the following fields:

  1. name: who commited the security violation
  2. security agent: who reported it
  3. location, time: 2 separate fields, you can guess what these hold

-------------------------------------------------------------------------------------------------------------------

  1. mailto: who is the manager of [name] - using a workflow this person will get a compiled mail with the info from this item/report
  2. penalty: what penalty is given to [name] for this violation

Field 1,2,3 are filled in at creation by the reporting security agent, fields A,B are filled in on edit by a supervisor from our security department.

But when fields A,B are filled in, it's good to know what other violations person [name] has committed in the past.

So in the EditForm (and displayform) I would like to add a webpart on the page showing the same list, but filtered on the field [name]. I know it should be possible, I tried 'filtered list view', but I can't get it to work properly.

I know this would be simple if I would use 2 separate lists, but since penalty and reports is on a 1 on 1 relationship, meaning there is only one penalty for each report, and one report for each penalty I'd like to keep in all in the same list. 2 lists make the setup more complex as I need to make sure both lists are up to date and consistent.


11 replies

Badge +7

Hi Thorsten Dehaes​,

I've tried this and got it working by configuring the list view as shown below, I've created a list called SecurityCheck with a view named Previous and a single line text column called Name, the form has the default controls.

181634_pastedImage_0.png

In addition I've got a formatting rule on the list view that hides it if the manager or penalty named controls are null or empty.

Hope that helps.

Jan

Badge +4

Not really. Perhapse I should have mentioned I'm not using what appears to be SharePoint 365. We're using SharePoint 2010 on servers configured for SharePoint 2013 (we're running a temporary compatibility mode)

So I wouldn't know where I could find those Control settings you're showing here. silly.png

Thanks a lot for the effort tho.

Badge +7

No worries, is it a basic SharePoint form then rather than Nintex?

Badge +4

Yes, this is purely basic SharePoint functionality (Tho not that basic given that I can't get it to work properly).

Badge +4

Is there a reason for not using Nintex form or can you use Workflow?  You could add a multiline column and run a workflow on creation and query for previous penalties.  With a rich text field you could build a string with html and format it pretty.

If workflow is not available, how good are you with javascript.  You could look into SPServices and use GetListItems to query the list and display the results.

Badge +7

Well you could try the following but not sure if it'll be exactly what you're after as it's. I've edited the default edit form and added a list view and connected the web parts up on Name.

181635_pastedImage_0.png

Then edit the list view web part and set the AJAX Options to allow a manual refresh to display the button highlighted in yellow above, you can click that to refresh the view filtered display based on Name.

181636_pastedImage_1.png

I've used a slightly different approach on the new item form and used a text filter web part that filters on name and again used the AJAX refresh to apply it. But it is a bit clunky.

Badge +4

This is more or less what I'm trying to do.

connecting the second list view to the first using the name as key.

But I'm not sure how this is done. The web part 'Filtered List view' is what my instinct tells me to use. But I'm not sure how to set it up.

If I add a list view on 'overtredingen' (that's the name of my list) I have Overtredingen[1] being my primary list, of which I'm editing the display form and Overtredingen[2] which I added to the display form of [1].

When I try to change the settings of [2] this is what I get.

overtredingen.jpg

When I select the 'get parameters' branch I can't set up anything else, but when I go to the Filter Values branch I get this:

181655_pastedImage_1.png

I'm pretty sure this is where the money is, but I have no clue how to set this up. I've been experimenting, but no bananas. At least not the good ones.

Badge +7

Yes that looks like what I've got, if you choose the filter values option can you pick the name from both the provider and consumer dropdown?

Badge +4

Yes, I just tried again, but instead of filtering on name, I used 'location' to filter. And that works perfectly. Filtering on name does not seem to work for some obscure reason.

So this is indeed the way to go. Now all I need to figure out is why it doesn't work on users.

Badge +4

And I figured that out just now.

A userfield is a complex field. It contains ID - Displayname - Account - Presence - ...
All that info is stored in that field. And filtering on it doesn't work.

I believe if I make an extra (hidden) field which is just a textfield filled with the displayname, I can use that textfield as the filterkey. This field i'll have to fill with a workflow, but I'm pretty sure that'll work.

Thanks for the help all. couldn't have done it without you.

Badge +7

Brilliant, glad it's all working.

Reply