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

Notifications

Announcements

No record found.

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,883

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,827 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,883 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,827 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans