Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Joined data source not updating after changing key value

(2) ShareShare
ReportReport
Posted on by 15
Hello.
 
I have table XKOMTestTable with 1 field VendAccount. This table have relation with VendTable (XKOMTestTable.VendAccount == VendTable.AccountNum).
 
On form I have inner join with VendTable and with DirPartyTable to show readonly vendor name. It works but when I change account number name is not changed until i refresh page.
 
Is it possible to update name after changing account number?
 
 
  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    Joined data source not updating after changing key value
    Can you show the table level relation properties with VendTable and the form level datasource properties?
  • Tomashu Profile Picture
    Tomashu 15 on at
    Joined data source not updating after changing key value
    Setting Only Fetch Active to No on both data sources don't change anything.
     
    Reread/research in VendAccount.modified don't do anything either. And I don't know why it should, it read data from database but at modified it's not changed yet.
     
    When I add 
    XKOMTestTable_ds.research(true);
    in XKOMTestTable.write it works. But it rereads while table when I know only 1 record is changed... :(
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 6,475 Super User 2024 Season 2 on at
    Joined data source not updating after changing key value
    Hi,
     
    Try to change the following property to No on DirPartyTable data source.
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    Joined data source not updating after changing key value
    Is it not changing even after saving the record?

    Only fetch active - keep this as default.
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 6,475 Super User 2024 Season 2 on at
    Joined data source not updating after changing key value
    Hi,
     
    Please try this code, but remove the code that you wrote on the write method.
     
     class VendAccount 
            {
                public void modified()
                {
                    super();
    
                    VendTable_ds.reread();
                    VendTable_ds.rereadreferencedatasource();
                    VendTable_ds.research(true);
               
                }
    
            }
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Tomashu Profile Picture
    Tomashu 15 on at
    Joined data source not updating after changing key value
    DirPartTable datasource looks like this:
     
    Using refresh/reread in modified/write doesn't help.
     
    [Form]
    public class XKOMTestTable extends FormRun
    {
        [DataSource]
        class XKOMTestTable
        {
            public void write()
            {
                super();
                
                XKOMTestTable_ds.reread();
                XKOMTestTable_ds.refresh();
                VendTable_ds.reread();
                VendTable_ds.refresh();
                DirPartyTable_ds.reread();
                DirPartyTable_ds.refresh();
                Info("write");
            }
    
            [DataField]
            class VendAccount 
            {
                public void modified()
                {
                    super();
    
                    XKOMTestTable_ds.refresh();
                    VendTable_ds.refresh();
                    DirPartyTable_ds.refresh();
                    Info("modified");
                }
    
            }
    
        }
    
        [DataSource]
        class VendTable
        {
            public void write()
            {
                
            }
    
            public boolean validateWrite()
            {
                return true;
            }
    
        }
    
        [DataSource]
        class DirPartyTable
        {
            public void write()
            {
                
            }
    
            public boolean validateWrite()
            {
                return true;
            }
    
        }
    
    }
     
    Table/form xml is here: https://pastebin.com/6CRM128T
    It was too long to include here.
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 6,475 Super User 2024 Season 2 on at
    Joined data source not updating after changing key value
    Hi,
     
    Can you share the properties of DirPartyTable Datasource? Also did you try to refresh datasource on the modified method of VendAccount?
    What is the Relation Link with DirPartyTable DataSource?
     
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Tomashu Profile Picture
    Tomashu 15 on at
    Joined data source not updating after changing key value
    I was using display method first but I need ability to sort/filter by vendor name.
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 10,150 Super User 2024 Season 2 on at
    Joined data source not updating after changing key value
    Hi,
     
    You can use a display method to show the name of vendor.
     
    Best regards,
    Mohamed Amine MAHMOUDI

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans