1

In the form cutslistepage , i want to get the value of accountNum of the selected row in grid and passe it to another form i have try that :

int64 recordsCount;

    recordsCount = CustTable_ds.recordsMarked().lastIndex();  
  //  CustTable = CustTable_ds.getFirst(1);
Ahmed
  • 259
  • 2
  • 9
  • 26

2 Answers2

2

If you want to retrieve the CustTable record, check the CustTableListPageInteraction class. In the selectionChanged method, it has the following code:

custTable = CustTable::findRecId(this.listPage().activeRecord(queryDataSourceStr(CustTableListPage, CustTable)).RecId);

This is how you can retrieve the record. But since it is already done, you can simply use the custTable variable that is already declared in the class declaration.

Side note: if you have an other form that is opened from the list page, it should automatically be filtered based on the relations between the data sources of the form. So you might be searching for a solution for a problem you shouldn't have. For example create a form that has a data source with a relation to the CustTable table on it and it should create a dynaink between the list page and your form, filtering the records for that customer.

Klaas Deforche
  • 1,151
  • 5
  • 9
  • I try this but is not work, he give the same value info(int642str(custTable.getFieldValue("AccountNum",1))); – Ahmed Jul 24 '14 at 14:36
  • Why are you using the `getFieldValue` method? Just use `info(custTable.AccountNum);`. Also, do not cast the `AccountNum` field from int64 to a string because it is a string, not int64. – Klaas Deforche Jul 25 '14 at 10:24
2

If only one record is selected you can do:

info(CustTable_ds.accountNum);

Otherwise, if more than one record is selected you need to do something like:

custTable = CustTable_ds.getFirst(true);
while (custTable)
{
    info(custTable.accountNum);
    custTable = CustTable_ds.getNext();
}
Kevin DeVoe
  • 600
  • 2
  • 8