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
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.
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.
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.
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.
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
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;
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
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.
Comments
IF RECORD.GET(KEY) THEN "Record exist"
ELSE "There is no such a record".
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');
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
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.
I would greately appreciate if u help me in doing the same thing if user selects a range of dates.
I need to work with a customer now $$$, but will respond when I can.
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
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;
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
Thanks for all the help.I greatly appreciate it.