How to filter using a table function instead of a field ?

Rogerio_FrancischiRogerio_Francischi Member Posts: 5
Hi all

I need to filter a table using a function of this table, instead of use a field.

Example : I have 2 tables with 1 to n relationsship

Table 1 - Contract

No. Date
CTR01 01/15/08
CTR02 02/21/08
CTR03 02/22/08

Table 2 - Certification

Contract No. Certification Code
CTR01 A
CTR01 B
CTR01 D
CTR02 B
CTR03 A
CTR03 D

I created a function on Contract table called GetCertificationCode
GetCertificationCode
ReturnText := '' ;
Certificaion.SETRANGE( "Contract No.", "No." ) ;

IF Certificaion.FINDFIRST() THEN
   REPEAT
      ReturnText += SaleCertificaion."Certifier Code" + ' / ';
   UNTIL SaleCertificaion.NEXT = 0 ;

IF ReturnText <> '' THEN
   ReturnText := COPYSTR( ReturnText , 1 , STRLEN( ReturnText) - 2 ) ;
EXIT( ReturnText ) ;
I have a form ( SourceTable = Contract ) where I need to filter by certification. As you can see above, certification is not a field of Contract table. I only have the function that returns the certification code from other table.

How can I do this kind of filter ?

Comments

  • ssissi Member Posts: 39
    I would add a textbox field to the top of the form where the user can enter the certificate number (similar to how the journal forms work). Then use the OnFindRecord and OnNextRecord triggers to determine if a record should be displayed. I think there is an example on mibuso. Search the forum for "filter for anything".
  • girish.joshigirish.joshi Member Posts: 407
    It would be better to create a boolean field called certification on your table and update it when neccesary.
Sign In or Register to comment.