Fellow developers, I have a custom list page, where a user can select few records, hit a button in Action pane that runs some logic in a class, and all that works fine. My problem is that the cursor does not stay at the same record but goes to the top of the grid. Sounds like a familiar issue?
I store the FormDataSource of the list page using args in the custom class that has all the logic.
I tried few things but none worked.
formDataSource.research(true) True parameter is supposed to retain the position after research does its job. I am guessing this should have been the most straightforward solution. List page query has 2 datasources joined using Outer join and my guess is research(true) works only with Inner joins.
formDatasource.setPosition(position)
int position;
position = formDatasource.getPosition();
formDatasource.research();
formDatasource.setPosition(position);
I store the position using getPosition and set it again using setPosition. No use.
formDataSource.findRecord()
currentRecord = formDatasource.cursor();
recId = currentRecord.RecId;
formDatasource.reread();
formDatasource.research();
formDatasource.findRecord(currentRecord);
i use the ds.cursor() to get the current record and pass it to findRecord() after research(). No use.
formDataSource.findValue()
currentRecord = formDatasource.cursor();
recId = currentRecord.RecId;
formDatasource.reread();
formDatasource.research();
formDatasource.findValue(fieldNum(Table, RecId), int642str(recId));
i use the ds.cursor() to get the current record and recId and pass it to findValue() after research(). No use.
I debugged the above code and the cursor() method does get the current record and its recId. I have started to believe that it might be a limitation of list page, and praying that somebody proves me wrong.
Any help is appreciated.
Use Method 3 but like this.
YourTable tmpTable;
currentRecord = formDatasource.cursor();
recId = currentRecord.RecId;
tmpTable = TmpTable::findByRecId(recId);
formDatasource.reread();
formDatasource.research();
formDatasource.findRecord(tmpTable);
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With