Ask Your Question
2

How can I retrieve the record from a factbox when a row is chosen?

asked 2022-11-28 11:00:00 +0000

ladyg gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-01-28 12:00:00 +0000

scrum gravatar image

To retrieve the record from a factbox when a row is chosen, you can use the OnAfterGetCurrRecord trigger.

First, you need to identify the factbox control and the field that contains the record ID. Then, you can use the GetRecord function to retrieve the record from the record ID.

Here's an example code snippet:

trigger OnAfterGetCurrRecord()
var
    Factbox: FactBox;
    RecordID: RecordID;
    MyRecord: Record MyTable;
begin
    // Identify the factbox control and field
    Factbox := Rec.FactBoxes.GetByControlID('MyFactbox');
    RecordID := Factbox.GetSelectedRecordID();

    // Retrieve the record using the record ID
    MyRecord.GetRecord(RecordID);

    // Do something with the record
    Message('Selected record: %1', MyRecord.Field1);
end;

In this example, we assume that the factbox control is named 'MyFactbox' and the record ID is stored in the default field 'RecId'. You would need to replace 'MyTable' and 'Field1' with the actual table and field names in your solution.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-11-28 11:00:00 +0000

Seen: 9 times

Last updated: Jan 28 '22