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

Community site session details

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

How to create RecordSortedList from a view

(0) ShareShare
ReportReport
Posted on by 170

Hi,

I have a formDataSource thats is a view. How can I create a RecordSortedList based on this fds?

I need to get the records selected in a form where the data source is my view. I dont need to pass the data that I included in that view using computed columns, the standard table is all I need.

private void buildInvoiceList()
{
    list = new RecordSortedList(tableNum(CustInvoiceJour));
    for (CustInvoiceJour = CustInvoiceJour_ds.getFirst(true) ? CustInvoiceJour_ds.getFirst(true) : CustInvoiceJour_ds.cursor(); CustInvoiceJour; CustInvoiceJour = CustInvoiceJour_ds.getNext())
    {

        list.ins(CustInvoiceJour);

    }
}

I have the same question (0)
  • Martin Dráb Profile Picture
    236,955 Most Valuable Professional on at
    RE: How to create RecordSortedList from a view

    You showed some code, but forgot to mention what problem you have with it. Please add this information.

    You mentioned a view, but CustInvoiceJour isn't a view. Doesn't it mean that your code uses a wrong data source?

    By the way, I strongly recommend using MultiSelectionHelper to get selected records. It's easier to use, leaving less room for bugs.

  • RadekM Profile Picture
    170 on at
    RE: How to create RecordSortedList from a view

    Ah yes well the view is CustInvoiceJour Itself with additional computed fields so like CustInvoiceJourView.

    I used this code before I made the change from table to view in my form because I needed more data on the form yet for the job I need only information stored in table CustinvoiceJour. The problem is invalid cast from CustinvoiceJour to CustInvoiceJourView when I change the table to view. Tried to overwrite it yet I had problem to get the count of selected items using recordsMarked() to loop through and since SysQuery::totalCount and totalNumberofRows is not what im looking for.

  • Martin Dráb Profile Picture
    236,955 Most Valuable Professional on at
    RE: How to create RecordSortedList from a view

    You indeed can't assign CustinvoiceJour to a variable for CustInvoiceJourView. These are two different things.

    I have no idea why you're trying to get the number of selected records. If you believe that it's needed for MultiSelectionHelper, you're wrong.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 580 Most Valuable Professional

#3
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 554

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans