Compare 2 fields in same table for filtering

krikikriki Member, Moderator Posts: 9,094
edited 2008-07-21 in NAV Tips & Tricks
A lot of times you want to filter records WHERE FIELD1 = FIELD2, but in Navision this is not possible. You need to read all records and then select the ones you need. With the help of a flowfield in the table, this can be done:

Example table 99999:"TheTable":
10:"KeyField" : any type
100:"FIELD1" : any type
110:"FIELD2" : any type but the same as FIELD1!
130:"FIELD1=FIELD2" : boolean flowfield
CALCFORMULA:Exist("TheTable" WHERE ("KeyField"=FIELD("KeyField"),"FIELD1"=FIELD("FIELD2")))
If this this field is TRUE, FIELD1 and FIELD2 have the same value.

=> in short : the flowfield must first filter on its primary key so it finds itself AND it has also to filter the 2 fields I want to compare.
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Comments

  • FranVLCFranVLC Member Posts: 22
    Great trick!! =D>

    What if i need to compare WHERE FIELD1 < FIELD2 ? I think it's not possible...
    Thank you very much to all users who actively participate in this forum!
  • krikikriki Member, Moderator Posts: 9,094
    No, it is not possible.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.