Skip to main content
Solved

How do I join a table (EPEmployees) twice for a view.

  • April 2, 2024
  • 1 reply
  • 63 views

I want to join a table (EPEmployees) twice to get employee and supervisor info and based on the user logged in I want to show either only an employees customers or the supervisors customers + the employees that report to them. This is what I have tried among a couple other ways:

public SelectFrom<Customer>
      .LeftJoin<Address>
          .On<Address.addressID.IsEqual<Customer.defAddressID>>
      .LeftJoin<CustSalesPeople>
          .On<Customer.bAccountID.IsEqual<CustSalesPeople.bAccountID>>
      .LeftJoin<SalesPerson>
          .On<CustSalesPeople.salesPersonID.IsEqual<SalesPerson.salesPersonID>>
      .LeftJoin<Users>
          .On<SalesPerson.descr.IsEqual<Users.email>>
      .LeftJoin<EPEmployee>
          .On<Users.pKID.IsEqual<EPEmployee.userID>>
      .LeftJoin<Supervisors>
          .On<EPEmployee.supervisorID.IsEqual<Supervisors.bAccountID>>
      .Where<
        Brackets<CustSalesPeople.isDefault.IsEqual<True>
          .And<Users.pKID.IsEqual<AccessInfo.userID.FromCurrent>>
        >
          .Or<
            Brackets<CustSalesPeople.isDefault.IsEqual<True>
              .And<AccessInfo.userID.FromCurrent.IsEqual<Supervisors.userID>>
            >
          >
      >
      .AggregateTo<GroupBy<Customer.acctCD , Max<SalesPerson.salesPersonID>>>
      .View CustomersView;
    
    public class Supervisors : EPEmployee { }

 

Thanks in advance!

Best answer by Mike Gifford

I haven’t tried it - but if you create a Supervisor class inherited from the EPEmployee class - then use the supervisor DAC instead in the FBQL - it should work.

 

There might be an aliasing property in FBQL that I am not aware of.

View original
Did this topic help you find an answer to your question?

1 reply

Mike Gifford
Jr Varsity III
Forum|alt.badge.img
  • Jr Varsity III
  • 25 replies
  • Answer
  • April 3, 2024

I haven’t tried it - but if you create a Supervisor class inherited from the EPEmployee class - then use the supervisor DAC instead in the FBQL - it should work.

 

There might be an aliasing property in FBQL that I am not aware of.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings