Link to home
Start Free TrialLog in
Avatar of rvfowler2
rvfowler2Flag for United States of America

asked on

FM - Portal Filter Issue2

Trying this one again and seeing if I can be clearer through more screen prints.

I tried to make a portal filter by two dimensions:  1) County (which is a single-entry field and works fine) and 2) Building Type (which is a checkbox or multi-entry field and does not work.  See attached for field calcs, etc.

(The check-box filter is the problem.  When I only link the relationship from County to the Countyfilter, it works fine.  When I add the buildingType checkbox field, it does not (see example in screen print where I select "Land" and it doesn't filter out the other selections).  (P.S. - I even tried to simplify by linking the PFbuildingtype field directly to the global field (g_FilterBuildingType) instead of the calc field (c_FilterBuildingType), and it still didn't work.  Any ideas?
-FilterPortalIssue.doc
-FilterPortalIssue2.JPG
Avatar of Will Loving
Will Loving
Flag of United States of America image

You are close. you just need to change your calculated value for the building type to use "1" instead of the ValueListItems function and then on the right side, create a calculated field for the BuildingType as follows:

c_PFBuidingType = List(  PFBuldingType ; 1 )

Make the relationship between the two calculated fields. See attached file. Double-Filter.fp7
Avatar of rvfowler2

ASKER

I'm a bit confused because in your sample db, you didn't relate calc to calc field for the Business Type but related BuildingType_c to BuildingType.

Also, does my original calc change as follows?  From:
If (
IsEmpty ( g_FilterBldgType  );
ValueListItems ( Get ( FileName );"BuildingType" );  
g_FilterBldgType
)

To:
Case ( not IsEmpty( g_BuildingType ) ; g_BuildingType ;
1 )

And, just to clarify, I'm relating the db to itself, not to another db.
Yes, you are correct about needing to make the relationship between both calc fields, and yes I believe your calculation is correct.

Actually, you don't need to do the calc fields at all unless you want to have it default to all Building Types being visible if none are selected. Check the attached file which just uses the original fields. If you want to have the default be that all Types are shown if none are selected - which I take it was your intent when you used the ValueListItems function - then you need to use make sure that there is a "1" in the calculation on both sides so that even if there are no values in either the Global or the CFBuildingType, the document will show up in the portal. Double-Filter2.fp7
This example shows it working as a self-join. It uses the original fields and no calcs. if nothing is selected, nothing show in the portal. Double-Filter3.fp7 and the second file shows it using the calc fields so that is nothing is selected all records are displayed.  Double-Filter4.fp7

Sometimes people will use something like "zzzzzzzz" instead of "1" as the constant, if there is any chance that the other referenced fields in the key might contain a 1.
Looks good in your db, but doesn't work in mine.  I even copied your formulas directly into my calc fields and then just changed the field name.  Attached is a copy of the Relationships chart and of the fields with the formulas showing.  Where did I go wrong?  (You can see in the second screenprint that no rows are showing in the middle portal.  Also, though I do use a calc for the county instead of the simple global as you do, it works by itself when I delete the building type from the "Edit Relationship" box.  All records show when no county is selected and the appropriate records do show when I do select a county.  
Screenprints this time.
-PortalFilterIssue3.doc
Check the Storage options for your PFBuildingType field to make sure it is indexed.
It was set to "none", so I set it to index automatically.  I then changed a couple of records, closed the db and reopened it and it still doesn't work.
Sorry, I doublechecked your calc Building Type field and saw it was indexed where mine was unstored.  Changed that and eveything showed up and is working fine.  One last question.  What does the "1" mean in the calc.  I'm sure it is easy and obvious, but I'm trying to understand why that worked over a the ValueListItems for a multi-entry check-boxed field when it works fine for a single entry field.  Thanks so much.
ASKER CERTIFIED SOLUTION
Avatar of Will Loving
Will Loving
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think you just missed my previous message.  It works great.  Thanks.  Just wondering how the "1" works in the calc.
The 1 just takes the place of the ValueListItems. It's simpler code on the left but it does require you to have a calc field that includes the 1 on the right so in purest terms, the ValueListItems () is the more elegant solution. The one advantage is that if you use the 1 and the calc field on the right, documents will appear even if there is NO value in the PFBuildingType field, for instance if someone neglected to mark it.  
Thanks for the quick and concrete solution.