Problem for search

flyingjuju
Member Posts: 35
Hello,
I have a problem in finding a code seller.
I look for the most recent sale with a vendor code active. And retrieve this code seller.
Here's what I do:
EnteteFacture.INIT;
EnteteFacture.RESET;
EnteteFacture.SETCURRENTKEY("N° donneur d'ordre");
EnteteFacture.ASCENDING(FALSE);
EnteteFacture.SETRANGE("N° donneur d'ordre","N° prospect");
MESSAGE(FORMAT(EnteteFacture.COUNT));
EnteteFacture.FIND('-');
IF EnteteFacture.FIND('-') THEN REPEAT
Vendeur.GET(EnteteFacture."Code vendeur");
MESSAGE(EnteteFacture."Code vendeur");
IF Vendeur.Actif = TRUE THEN BEGIN
"Code vendeur" := EnteteFacture."Code vendeur";
EXIT;
END;
UNTIL NEXT = 0;
My code is good? because I can not get the good result
thank you for the help you can give me
I have a problem in finding a code seller.
I look for the most recent sale with a vendor code active. And retrieve this code seller.
Here's what I do:
EnteteFacture.INIT;
EnteteFacture.RESET;
EnteteFacture.SETCURRENTKEY("N° donneur d'ordre");
EnteteFacture.ASCENDING(FALSE);
EnteteFacture.SETRANGE("N° donneur d'ordre","N° prospect");
MESSAGE(FORMAT(EnteteFacture.COUNT));
EnteteFacture.FIND('-');
IF EnteteFacture.FIND('-') THEN REPEAT
Vendeur.GET(EnteteFacture."Code vendeur");
MESSAGE(EnteteFacture."Code vendeur");
IF Vendeur.Actif = TRUE THEN BEGIN
"Code vendeur" := EnteteFacture."Code vendeur";
EXIT;
END;
UNTIL NEXT = 0;
My code is good? because I can not get the good result
thank you for the help you can give me
0
Answers
-
EnteteFacture.INIT; // remove this line, there's no need for it EnteteFacture.RESET; EnteteFacture.SETCURRENTKEY("N° donneur d'ordre"); EnteteFacture.ASCENDING(FALSE); EnteteFacture.SETRANGE("N° donneur d'ordre","N° prospect"); MESSAGE(FORMAT(EnteteFacture.COUNT)); // Do you get a number here? EnteteFacture.FIND('-'); // remove this line - you will get an error if the number in the message is 0 IF EnteteFacture.FIND('-') THEN REPEAT Vendeur.GET(EnteteFacture."Code vendeur"); MESSAGE(EnteteFacture."Code vendeur"); // Do you get a vendor number here? IF Vendeur.Actif = TRUE THEN BEGIN "Code vendeur" := EnteteFacture."Code vendeur"; EXIT; END; UNTIL NEXT = 0;
Do you get any messages? Look at my comment in the code0 -
For EnteteFacture.COUNT, I have a number and this is the good number
For EnteteFacture."Code vendeur", I have a number and this is the good number
That's why I don't understand why it doesn't work0 -
Remove EXIT; in your code and try..0
-
I don't have the good result without EXIT0
-
May I know what are you expecting from the code and what is not working?0
-
through this code, I search the last active seller who make the sale to a prospect well defined.
I feel that my REPEAT loop does not work and he does not repeat until it is not a good result
You will find attached screenshots of examples, as well as the complete code that is executed in the table.
Anything I add, you will find after //JW
There may be something else that conflicts but I can not find anything.
I have to add a function for what I need I call UpdateCodeVendeurCampagneFidé0 -
Hi
I think "UNTIL NEXT = 0;" should be "EnteteFacture.NEXT = 0;".0 -
chi wrote:Hi
I think "UNTIL NEXT = 0;" should be "EnteteFacture.NEXT = 0;".0 -
Thank you very much. It works.
I had not thought about it because I thought the "NEXT" was implicit but thinking a little more, it is logical0
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