Use of 'OnFindRecord' On 'OnNextRecord' - I'm almost there

jensthomsenjensthomsen Member Posts: 173
On table 156 we have created a new option field 'Main_Sub' to allow us to have Main- and submachines in the same table. Now the challenge is to build a new page to illustrate the main-sub structure of a machine: One line would be the Main (Headerline) and under that we could have several sub-lines. I have tried with the following code ('BufferTable' is a new table with PK equal to "Code 1"):

***************

OnInit()
BufferTable."Code 1" := '1300';
BufferTable.Integer_1 := 1;
BufferTable.INSERT;

BufferTable."Code 1" := '1000';
BufferTable.Integer_1 := 2;
BufferTable.INSERT;

BufferTable."Code 1" := '1160';
BufferTable.Integer_1 := 3;
BufferTable.INSERT;

BufferTable."Code 1" := '1850';
BufferTable.Integer_1 := 4;
BufferTable.INSERT;

BufferTable.SETCURRENTKEY(Integer_1);

OnFindRecord(Which : Text) : Boolean
IF BufferTable.GET("No.") THEN;

IF NOT BufferTable.FIND(Which) THEN
EXIT(FALSE);

IF NOT GET(BufferTable."Code 1") THEN
EXIT(FALSE);

EXIT(TRUE);

OnNextRecord(Steps : Integer) : Integer
IF NOT BufferTable.GET("No.") THEN
EXIT(0);

CurrSteps := BufferTable.NEXT(Steps);
IF CurrSteps <> 0 THEN
IF NOT GET(BufferTable."Code 1") THEN
CurrSteps := 0;

EXIT(CurrSteps);
***************

The idea of the code is, that Machine No. '1300' is the Main Machine and therefore should be the Header-line in the page (and I could do some conditionalle formatting of the line). The code works ok: The Machine line is in fact in top of the page....But it's not possible to do any further filtering of the lines?? Some might argue that this would be ok in this particular scenario, but anyway...
Sign In or Register to comment.