Doubt on FINDSET and FINDFIRST

gdkve9
Member Posts: 161
Dear Mibusonians,
HaPPy New Year 2010 to one and all. Hope every one doing good.
The problem I am facing seems to be very basic but unable to sort it out. I need to use ASCENDING Function and as this function doesnt work with FINDSET, I have replaced the FINDSET with FINDFIRST in the code shown below.
Here my problem is if I use FINDSET, the loop for REPEAT..UNTIL works (as I have defined multiple prices for a specific customer and specific item with varying price on different Minimum Qty), but the same doesnt work for FINDFIRST.
Kindly suggest proper method where is I can be able to use the ASCENDING function and also the REPEAT..UNTIL loop works in the above mentioned case.
Awaiting for your earliest suggestions. Thanks in advance to all.
HaPPy New Year 2010 to one and all. Hope every one doing good.
The problem I am facing seems to be very basic but unable to sort it out. I need to use ASCENDING Function and as this function doesnt work with FINDSET, I have replaced the FINDSET with FINDFIRST in the code shown below.
WITH SalesPrice DO BEGIN //>>Dilip 27Nov2009 //FoundSalesPrice := FINDSET; FoundSalesPrice := FINDFIRST; ASCENDING(FALSE); //<<Dilip 27Nov2009 IF FoundSalesPrice THEN REPEAT IF IsInMinQty("Unit of Measure Code","Minimum Quantity") THEN BEGIN ConvertPriceToVAT( "Price Includes VAT",Item."VAT Prod. Posting Group", "VAT Bus. Posting Gr. (Price)","Unit Price"); ConvertPriceToUoM("Unit of Measure Code","Unit Price"); ConvertPriceLCYToFCY("Currency Code","Unit Price"); CASE TRUE OF ((BestSalesPrice."Currency Code" = '') AND ("Currency Code" <> '')) OR ((BestSalesPrice."Variant Code" = '') AND ("Variant Code" <> '')): BestSalesPrice := SalesPrice; ((BestSalesPrice."Currency Code" = '') OR ("Currency Code" <> '')) AND ((BestSalesPrice."Variant Code" = '') OR ("Variant Code" <> '')): IF (BestSalesPrice."Unit Price" = 0) OR (CalcLineAmount(BestSalesPrice) > CalcLineAmount(SalesPrice)) THEN BestSalesPrice := SalesPrice; END; END; UNTIL NEXT = 0; END;This code is in Codeunit 7000 Sales Price Calc. Mgt.\CalcBestUnitPrice(SalesPrice).
Here my problem is if I use FINDSET, the loop for REPEAT..UNTIL works (as I have defined multiple prices for a specific customer and specific item with varying price on different Minimum Qty), but the same doesnt work for FINDFIRST.
Kindly suggest proper method where is I can be able to use the ASCENDING function and also the REPEAT..UNTIL loop works in the above mentioned case.
Awaiting for your earliest suggestions. Thanks in advance to all.
Dilip
Falling down is not a defeat..defeat is when you refuse to get up.
Falling down is not a defeat..defeat is when you refuse to get up.
0
Answers
-
Hi Dilip,
As your sorting is DESCENDING you UNTIL NEXT = 0; statement should be NEXT(-1) = 0;
Hope this helps.
Albert0 -
Thanks a lot Albert.
I just missed my focus at that line of Next = 0;
Yes, As I am desending the sort, Next(-1) = 0 should be the condition to add it there. It works fine now.
Thanks again.Dilip
Falling down is not a defeat..defeat is when you refuse to get up.0 -
Why do you want to do this?
This loop finds the best sales price and IMHO it does not matter if you start at the bottom or beginning.
Just Curious.
Oh, and change the FINDFIRST to a FIND('-') please.0 -
And give this one a look: http://www.mibuso.com/howtoinfo.asp?FileID=22Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions