Simple question

ayamasayamas Member Posts: 15
Hi guys,
Its just one week that i have moved to navision development.What I want to know is that how can i check whether a record exists in the table.
Thanks in advance

Comments

  • andrejsmandrejsm Member Posts: 122
    Hi,
    IF RECORD.GET(KEY) THEN "Record exist"
    ELSE "There is no such a record".
    Andrejs Muraskins
  • bbrownbbrown Member Posts: 3,268
    If you are looking for 1 record based on primary key, then use Rec.GET.

    If you are checking to see if any records are in table, then use Rec.ISEMPTY.

    Example:

    Rec.SETFILTER(....)..
    IF Rec.ISEMPTY THEN
    MESSAGE('No Records')
    ELSE
    MESSAGE('Records Found');
    There are no bugs - only undocumented features.
  • ayamasayamas Member Posts: 15
    Thanks for all the replies,
    But still i am not able to get the needed output.
    I have a date filter where the user enters the date & then the application treis to find the record in the table named Purch. Inv. Line & if does not finds the dates in the Purch. Inv. Line table it tries to find it in another table named as Item ledger entry.
    Can I pls get the exact syntax.

    Any help is greatly appreciated
  • bbrownbbrown Member Posts: 3,268
    Two qustions

    1. Is the user entering a single date or a range of dates?

    2. Do you need to handle the record after finding it, or just check if it exist.
    There are no bugs - only undocumented features.
  • ayamasayamas Member Posts: 15
    The user enters just the single date & I just want to check the record if it exists
    I would greately appreciate if u help me in doing the same thing if user selects a range of dates.
  • bbrownbbrown Member Posts: 3,268
    How are you filtering the "Purch. Inv. Line" table? The "Item Ledger Entry" table has a "Posting Date" that would probably correspond to the date entered by the user, but the "Purch. Inv. Line" table does not.

    I need to work with a customer now $$$, but will respond when I can.
    There are no bugs - only undocumented features.
  • ayamasayamas Member Posts: 15
    OK now please let me give u the details of what i am trying to acheive.
    I am trying to write the stock ageing report.
    Here for each item I want to find a last purchase date which is present in purchase.Inv.Line table & for tat item if there is no last purchase date then i want to find the last positive adjustment date which is present in the Item ledger entry.

    Thanks In advance
  • ashishguptaashishgupta Member Posts: 24
    If user enters a single date then.............
    Store userdate in a varaible. let's say SearchDate.
    then create a record variable of purchase Invoice line. let's say PurchInvLine.
    PurchInvLine.setrange(PurchInvLine.Field,SercahDate);
    If PurchInvLine.find('-') then
    Begin
    Write ur logic here.
    End
    Else
    Begin
    ItemLedentry.setrange(ItemLedentry.Field,SercahDate);
    If ItemLedentry.find('-') then
    Begin
    Write ur logic here.
    End

    End;
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    An outline:
    CLEAR(PurchInvHeader);
    PurchInvHeader.SETCURRENTKEY("Posting Date"); //create the key if it does not exist
    PurchInvHeader.SETFILTER("Posting Date",UserDateFilter); // invoice lines do not contain posting date
    IF PurchInvHeader.FIND('-') THEN BEGIN
        CLEAR(PurchInvLine);
        PurchInvLine.SETRANGE("Document No.",PurchInvHeader."No.");
        IF PurchInvLine.FIND('-') THEN REPEAT
              //do something
        END;
    END ELSE BEGIN
       CLEAR(ItemLedgEntry);
       //same key-key-filtering-repeat stuff
    END;
    
  • ayamasayamas Member Posts: 15
    edited 2006-05-17
    Thank you guys for all the replies
    But since I am new to navision development can anyone pls tell me in what report trigger to write all the code.Can anyone please categorise for me.
    I know I am asking for spoon feeding but I am very new to this kind of enviroment
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    See, I won't work this way. It's not possible to remote control a beginner over the forum to perform a development task of approximately medium difficulty. Just tell your boss you need to learn this stuff first, and spend at least three days reading Application Designer's Guide, Solution Developer's Guide, searching for all report triggers in the C/SIDE help etc.
  • ayamasayamas Member Posts: 15
    Ok I understand.
    Thanks for all the help.I greatly appreciate it.
Sign In or Register to comment.