web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

notexists join not working with tempTable

(0) ShareShare
ReportReport
Posted on by 1,909

Hello,

I have a records in tempTable and I'm trying return a records from temTable if there is doesn't exist a match in the second table(CustTable). It works below code but the all values starting from  603 in below code always return twice where first two values 11102206","12104348" already exists in  first & second table and its not returns value as expected. But I have issue values keep repeating. I'm expecting single output("603","604","605","606","607") but its not works as expected. Please advise.

static void readJSON(Args _args)
{
mapEnumerator mapEnumerator;
Map data;
List testList;
str _jsonStr;
container test;
ListEnumerator listEnumerator;
int containerList;
Map map1;
int lengthIterate;
CustTable custable;
TempMirnahCust tmpMirnahCust;
str _conpkrsult;

;
_jsonStr = '{"branchList":["11102206","12104348","603","604","605","606","607"]}';
data = RetailCommonWebAPI::getMapFromJsonString(_jsonStr);
mapEnumerator = data.getEnumerator();
while (mapEnumerator.moveNext())
{
switch (mapEnumerator.currentKey())
{
case "branchList" :
test = mapEnumerator.currentValue();
testList =List::create(test);
listEnumerator = testList.getEnumerator();
while (listEnumerator.moveNext())
{
test = listEnumerator.current();

 _conpkrsult = conpeek(test, 1);
      
    tmpMirnahCust.MirnahCode = _conpkrsult;
    
    tmpMirnahCust.insert();
   
        while select tmpMirnahCust where  tmpMirnahCust.dataAreaId == custable.dataAreaId
            notexists join custable
            where custable.MirnahCode == tmpMirnahCust.MirnahCode
        {
             
            print tmpMirnahCust.MirnahCode;      
             pause;
    }
  

}
break;
}
}
}

I have the same question (0)
  • GirishS Profile Picture
    27,843 Moderator on at

    Hi Faqru Shaik,

    What is the functionality you are trying to achieve from the above code?

    Also if you want to print the customer other then custTable, You need to add the while loop outside of the list and map enumerator.

    TempMirnahCust tmpMirnahCustBuffer;
    while select tmpMirnahCustBuffer where tmpMirnahCustBuffer.dataAreaId == custable.dataAreaId
        notexists join custable
        where custable.MirnahCode == tmpMirnahCustBuffer.MirnahCode
    {
        print tmpMirnahCustBuffer.MirnahCode;      
        pause;
    }

  • Faqruddin Profile Picture
    1,909 on at

    Hello Girish,

    Actually I have api which returns customers and I'm trying to read those customers which not exists in custtable. I try loop outside of list and map enumarator but its doesn't print anything. Could you please past full code from above.

    Thank you

  • Verified answer
    GirishS Profile Picture
    27,843 Moderator on at

    Hi Faqru,

    Try the below code.

    Instead of adding a while select statement - Check if the customers exist in the cust table by adding a select statement - If exist add it to the container.

    So outside the while loop print the container using con2str function.

    static void readJSON(Args _args)
    {
    mapEnumerator mapEnumerator;
    Map data;
    List testList;
    str _jsonStr;
    container test;
    ListEnumerator listEnumerator;
    int containerList;
    Map map1;
    int lengthIterate;
    CustTable custable;
    TempMirnahCust tmpMirnahCust;
    str _conpkrsult;
    
    ;
    _jsonStr = '{"branchList":["11102206","12104348","603","604","605","606","607"]}';
    data = RetailCommonWebAPI::getMapFromJsonString(_jsonStr);
    mapEnumerator = data.getEnumerator();
    while (mapEnumerator.moveNext())
    {
    switch (mapEnumerator.currentKey())
    {
    case "branchList" :
    test = mapEnumerator.currentValue();
    testList =List::create(test);
    listEnumerator = testList.getEnumerator();
    while (listEnumerator.moveNext())
    {
    test = listEnumerator.current();
    
     _conpkrsult = conpeek(test, 1);
          
        tmpMirnahCust.MirnahCode = _conpkrsult;
        
        tmpMirnahCust.insert();
        custTable.clear();
        select * from custTable
            where custTable.MirnahCode == tmpMirnahCust.MirnahCode;
            if(!custTable)
            {
                // create new container and add it to the container.
                container custTableNot;
                custTableNot  = tmpMirnahCust.MirnahCode;
            }
            
      
    
    }
    break;
    }
    }
    info(strfmt("%1", con2str(custTableNot)));
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 608

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 591 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 430

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans