Skip to main content

Notifications

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

How to create RecordSortedList from a view

(0) ShareShare
ReportReport
Posted on by 76

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);

    }
}

  • Martin Dráb Profile Picture
    Martin Dráb 230,817 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.

  • RadekM Profile Picture
    RadekM 76 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
    Martin Dráb 230,817 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.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,817 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans