Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8118977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:39:48+00:00 2026-06-06T04:39:48+00:00

I am trying to get customer or prospect using X++ and use it on

  • 0

I am trying to get customer or prospect using X++ and use it on a lookup.
There is a method in the DirPartyTable that returns what I want.

DirPartyTable::isCustomerOrRelation

while select * from dirPartyTable
{
       if(DirPartyTable::isCustomerOrRelation(dirPartyTable.RecId))
       {

                //Get the Name
                //info(dirPartyTable.Name);
       }
}

But when I build a query to the lookup I am trying to pass the DirPartyTable::isCustomerOrRelation(dirPartyTable.RecId) on the addRange of the query somehow.
Is there a way to do it or is it impossible ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:39:50+00:00Added an answer on June 6, 2026 at 4:39 am

    If you go to the source of isCustomerOrRelation (and isCustomer and isRelation) you see, that the method returns true if a customer or prospect exists in the current company.

    Your while select, while correct, is inefficient, because it may have to scan a million parties to select on thousand customers or prospects present in you current company.

    A more efficient, but syntactical illegal, while select would be:

    while select * from dirPartyTable
       exists join custTable
       where custTable.Party == dirPartyTable.RecId
       union 
       select * from dirPartyTable
       exists join smmBusRelTable
       where smmBusRelTable.Party == dirPartyTable.RecId;
    {
         info(dirPartyTable.Name);
    }
    

    While illegal in X++ it is possible using queries and views.

    1. Make two queries (translate to appropriate properties yourself):

    2. Query1:

      select * from dirPartyTable
          exists join custTable
          where custTable.Party == dirPartyTable.RecId
      
    3. Query2:

      select * from dirPartyTable
          exists join smmBusRelTable
          where smmBusRelTable.Party == dirPartyTable.RecId;
      
    4. Make two views (View1 and View2) based on the queries.

    5. Make a union query (Query3), see how to Combine Data Sources in a Union Query, remember to specify the UnionType (Union or UnianAll).

    6. Make a view based on the Query3, see how to Create a View Based on a Query.

    Result, select all records using X++:

    while select * from dirPartyCustOrRelationTable
    {
         info(dirPartyCustOrRelationTable.Name);
    }
    

    Or you can use the Query3 directly to retrieve the records.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying get all html links within a string and replace them using
I am trying get all html links within a string and replace them using
I am trying get Struts 2 and Tiles to work and I am using
I'm trying to get it so a customer can add a shipping address in
Trying to get a simple COUNT from a table that takes a couple of
I'm using Rails 2.3.2, and trying to get a nested object form to work
We're currently using Salesforce for our sales process, which involve trying to get people
I'm a sometime developer who is trying to get up to speed on customer-facing
We're trying to get some usage metrics on a VB6 application that we are
I'm new to IoC and I'm trying to get started using StructureMap, but it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.