Display only unique results from search

Debbie140Debbie140 Member Posts: 52
edited 2008-10-29 in Navision Attain
I have been looking for a way to search a table in Navision. From previous posts I have discovered that I can loop through a table setting marks on records which match my criteria then show only the marked as below

// Filter on FieldA
SETCURRENTKEY(FieldA);
SETRANGE(FieldA, ValueA);
// Mark records
IF FIND('-') THEN
REPEAT
MARK(TRUE);
UNTIL NEXT = 0;
// Remove filter again
SETRANGE(FieldA);

//set primary key and display marked only

Whether this is the best way to do it or not I am unsure. My problem is that I want to display only one field of the results e.g FieldB. Because FieldB is not the primary key of the table there are duplicate values. I only want to display unique values. Is there a navision function for doint this or a way around it?

Comments

  • gulamdastagirgulamdastagir Member Posts: 411
    Calling all Gurus!

    In SQL we use the Keyword "UNIQUE" to get a list of Unique values how can we do it in CAL?
    Regards,

    GD
  • SavatageSavatage Member Posts: 7,142
    Because FieldB is not the primary key of the table there are duplicate values.

    ??

    you want to display a unique field that has mutliple matches?

    well there must be something differnt about it to find it
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Create a temporary table and insert into that, using the field you need to be unique as the primary key of the temp table.
    David Singleton
  • gulamdastagirgulamdastagir Member Posts: 411
    darn it! i never knew reports cud be so powerful :whistle:
    Regards,

    GD
Sign In or Register to comment.