Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

update_recordset does not work well in X++

Posted on by
Hello, I would like to modify the <original source> to an /update_recordset/ process to lighten the process.
I've tried to write it, but the conditions don't seem to match and it doesn't work, so I need your help.
I am really in trouble...  and would appreciate your help.

※Each table and field name corresponds to a table and field name.
※I think the exists join is necessary because the data may diverge.
<original source>
        while select
                    Field_A,                         
                    Field_B,                   
                    Field_C                                
                from
                    Table_A
               where
                        Table_A.Field_D != /1/
                 && Table_A.Field_D != /2/
        {
            Str_N = empty;
            Original_Table Table_B;
            Table_B.linkPhysicalTableInstance(Table_L);
            select firstonly
                    Field_A                        
            from
                    Table_B
            where
                   Table_B.Field_D == /2/                                               
            && Table_B.Field_B == Table_A.Field_B    
            && Table_B.Field_C == Table_A.Field_C;                           
            Str_N = Table_B.Field_A;
            if (Str_N == empty)
            {
                select firstonly
                       Field_A                           
                from
                       Table_Z
               where
                       Table_Z.Field_D == /2/                                              
                && Table_Z.Field_B == Table_A.Field_B    
                && Table_Z.Field_C == Table_A.Field_C;                          
                Str_N = Table_Z.Field_A;
                if (Str_N == empty)
                {
                 while select forupdate Table_L
                     where
                         Table_L.Field_A == Table_A.Field_A
                        {
                         Table_L.Field_E = empty;
                         Table_L.Field_F = empty;
                         Table_L.Field_G = /u/;
                         Table_L.update();
                        }
                }
            }
        }
 
 
<My idea (not going to work) >
        update_recordset Table_L
            setting 
                Field_E = empty,
                Field_F = empty,
                Field_G = /u/
            where
                Table_L.Field_A == Table_A.Field_A
            join
                Field_A,                
                Field_B,                  
                Field_C                              
            from
                Table_A
            where
                Table_A.Field_D != /1/
             && Table_A.Field_D != /2/
            exists join
                Field_A
            from
                able_B
            where
                Table_B.Field_D == /2/                                 
            &&  Table_B.Field_B == Table_A.Field_B  
            &&  Table_B.Field_C == Table_A.Field_C              
            &&  Table_B.Field_A == empty
            exists join
                Field_A
            from
                Table_Z
            where
                Table_Z.Field_D == /2/                                   
            &&  Table_Z.Field_B == Table_A.Field_B    
            &&  Table_Z.Field_C == Table_A.Field_C             
            &&  Table_Z.Field_A == empty;

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans