Jump to content
Sign in to follow this  
aeu

problem with value list based on complex relationship with indexing

Recommended Posts

Not sure if this post should be here or under the Relationships forum, but here goes:

I have a system that records the payments I make to vendors based on their work on projects. When I create a new payment, it has line items for multiple project line items that a vendor might have worked on.

Here are some key tables and relationship fields (note: foreign keys begin with "F_"):

Payment (F_vendorID)

PaymentLine (F_projectID)

Project (isActive.boolean)

ProjectLine (F_vendorID)

Vendor

Here are some key ERD points:

Payment has one Vendor

Payment has many PaymentLine

PaymentLine has one ProjectLine

Project has many ProjectLine

ProjectLine has one Vendor

The Payment layout has a portal showing PaymentLine items. I want each PaymentLine record in the portal to have a Pop-Up Menu that lists ProjectLine records from active Projects (where isActive.boolean = 1) by Vendor (as selected for the Payment).

I'm running into a snag because the relationship for the value list from PaymentLine to ProjectLine needs both vendorID and isActive.boolean (connected from a constant "1" field). However, F_vendorID resides in the projectLine table and isActive.boolean resides in the Project table. When I try to duct tape it by using a calculated field in projectLine to pull in the value of isActive.boolean, it won't let me index the field, and thus the value list and relationship from PaymentLine to ProjectLine do not work.

Any help with this puzzle would be most appreciated!

Share this post


Link to post
Share on other sites

Try defining a a calculation field cActiveID in ProjectLines as =

Case ( Projects::IsActive ; ProjectLineID )

Then define two relationships:

Vendors::VendorID = ProjectLines 2::VendorID

ProjectLines 2::cActiveID = ProjectLines 3::ProjectLineID

Now you can define your value list as showing only related values from ProjectLines 3, starting from Vendors.

Share this post


Link to post
Share on other sites

Works like a champ - thanks!

Note: the only change I made to what you suggested is that I started the value list related values from Payment rather than Vendors, since the field containing the vendorID in question is in the Payment table (i.e. the Vendor who is getting paid).

Share this post


Link to post
Share on other sites

I believe it shouldn't matter, since it's the same vendor. Come to think of it, you could attach the added TO's directly to the Payments table instead of Vendors - since again, it's the same VendorID in both.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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