Statement is false, but it get executed like true

BlankName
Member Posts: 20
I want to check last prod. order no. vs current and if they are different input it into temp table. And statement in attached photo is false, but somehow it gets interpreted as true, when both prod.order no. are same. Why this is happening?


0
Best Answer
-
AlexDen is right... Compiler caches and shows last value assigned to the variable, that's why statement was true.0
Answers
-
Hi,
You check only first record.
You have to move this check into the loop:IF TRH.FINDSET THEN REPEAT IF TRH."Production Order No." <> LastEntry THEN BEGIN ... END; UNTIL TRH.NEXT = 0;
0 -
There is 2 loops and when it gets out of first loop I want to make that check in debugger window at right you can see those two variables being the same. And I get error when it tries to write to my temp table because record already exist and my statement lastentry <> prod order no. was accepted as true when in reality they are both same and it shouldn't be true.0
-
Yes, I see.
Your code will not work if there will be records like this:
Order 1
Order 2
Order 1 // Last Entry = Order 2, bit Order 1 is already saved in temp table and you will get an error.
1 -
AlexDen is right... Compiler caches and shows last value assigned to the variable, that's why statement was true.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