Jump to content
Server Maintenance This Week. ×

Filtering Portal To Show Unique Records Only


pmmarketing

This topic is 7585 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Here is my scenario:

I have a contributions database and a members database. I have setup a relationship from a global field in contributions to a calculation field named "c_quick_key" in the members database. This relationship is used to allow the user to search by part of a member's name or their giving id. By entering part of the member's last name records are displayed in the portal. When a user click's on a record in the portal the GIVING ID field is set. This works great.

The problem is that most husbands & wives have the same giving id. This is for tax purposes. Since most of our members file their taxes jointly they share the same giving id. Now some husbands & wives have seperate giving id's which is ok to show them in the portal. I would prefer not to show duplicate giving id's in the portal.

How can this be done? This is what I have attempted to do:

I have setup a Self Join with a unique serial number RecordID field in the members database. I then have a calculation named "show_unique".

show_unique = Case(RecordID = Max(Selfjoin::RecordID), c_quick_key, "")

I then setup the relationship from the global field in conributions to the show_unique field in the memebers database. The problem is that the show_unique field cannot be indexed.

Is there another way of doing this to filter the records?

Sorry for the winded post but I am clueless.

Thanks in advance

Link to comment
Share on other sites

Hmm..So you're using a Claircoyance tool.

Try this one.

keep your classic c_quick_key as it is, as well as your relationship global::c_quick_key.

In your portal, drop the LastName field and set it to the same color of the backgroud.

Change your calculation to

show_unique = Case(RecordID = Selfjoin::RecordID, Name, "") and put this calc just over the Name field, in a "readable" color.

Finally, use an additional calculation :

c_sortkey = Case(RecordID = Selfjoin::RecordID, 1, 0)

In the define relationship box, use the c_sortkey as your sort key.

Now, all the duplicates would drop down the list and be invisible, showing only a list of single items.

Link to comment
Share on other sites

FYI.

I was able to fix this by changing the show_unique field into a text field. Then I set the text field with my startup script for all of the records. Now that the field can be indexed it works fine.

If someone knows a better way of doing this please let me know.

grin.gif

Link to comment
Share on other sites

Hi,

Sure having an index is still the best way to go.

As you're only looking for a way to DISPLAY the records, the "Display workaround" would just be quicker than any scripted process.

If you were to print a report, I'd totally agree with the "flag" method, even if I'm not sure exactly what your script is doing (changing the calc to a multikey text string ? by a Replace command or loop through the whole database ?)

Link to comment
Share on other sites

Yes, I am using a loop command through the whole database. I like your idea better because it does not require the script to loop through all of the records. Soon we will have all 2000 members in the database and it may take some time to loop through them everytime..

Thanks for all of your help Ugo. grin.gif I really appreciate it.

Link to comment
Share on other sites

Glad you find it useful. I use this tip daily and it never failed.

I'd suggest you keep your t_index field though.

A portal view is sometimes the first step for a print report process. Yours is a Clairvoyance Filter, but if you have the "All" text string available to show 'all members' and want to print this purged list , you'd just have to use another little script that sets the text field for a new valid relationship.

Link to comment
Share on other sites

Consider the "Concanation" though if it was based on Name field...

Now, about the index, here comes a better approach than a loop.

Create a blank layout with only one calculation filed on it.

C_showID = Case(Record_ID = Selfjoin::Record_ID, Record_ID, "")

Create another layout with only one global field.

Create a global field g_Match.

The script would from the Main file.

Go to Related Records (your current relationship-show only)

Go to "Blank Layout"

Copy all records

Go to "Global Layout"

GotoField (g_Match, select)

Paste

Go to Related records (g_Match::Record_ID)

Go to Layout "Report"

Sort by Name

Print

Link to comment
Share on other sites

This topic is 7585 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.