FIND or GET

gulamdastagirgulamdastagir Member Posts: 411
I have table with three fields Entry No,Contact No,User

Entry Number is the Primary key

Contact No,User is the Secondary key
recProspect.RESET;
recProspect.SETCURRENTKEY(recProspect."Contact No",recProspect."User");
recProspect.SETFILTER(recProspect."Contact No","Contact No.");
recProspect.SETFILTER(recProspect."User","USER ID");
IF recProspect.FIND('-')  THEN MESSAGE('You have to Send the Details');

The message box doesnt display even when there is a record with the company and User.
Regards,

GD

Comments

  • ara3nara3n Member Posts: 9,256
    Debug it and see what the filters are on recProspect
    when the findfirst is called.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Alex_ChowAlex_Chow Member Posts: 5,063
    Check your User field to see if it's CODE or TEXT. Text is case sensitive.
  • garakgarak Member Posts: 3,263
    Do you mean the UserID of curr. logon user :?:
    This ist the global vaiable USERID.
    You use recProspect.SETFILTER(recProspect."User","USER ID");
    What is "User ID"?
    Is this an field in your table or an other variable and whats the value ?

    Regards
    Do you make it right, it works too!
  • Stardust77Stardust77 Member Posts: 95
    garak wrote:
    Do you mean the UserID of curr. logon user :?:
    This ist the global vaiable USERID.
    You use recProspect.SETFILTER(recProspect."User","USER ID");
    What is "User ID"?
    Is this an field in your table or an other variable and whats the value ?

    Regards
    Perhaps it should be:
    recProspect.SETFILTER(recProspect."User",USERID);
  • WaldoWaldo Member Posts: 3,412
    Please send the contents of the table ... and try to answer the question about the "USER ID"/USERID :| . Also, where does the value of "Contact No." come from?

    I suggest to use SETRANGE instead of SETFILTER .. and using the ISEMPTY statement, like:
    recProspect.RESET; 
    recProspect.SETCURRENTKEY("Contact No","User"); 
    recProspect.SETRANGE("Contact No","Contact No."); 
    recProspect.SETRANGE("User",USERID); 
    IF NOT recProspect.ISEMPTY THEN 
      MESSAGE('You have to Send the Details');
    

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
Sign In or Register to comment.