Dynamic code changing?

abartonicek
Member Posts: 162
I know you all think that's impossible, but, Navison can do that too 
I have this line of code:
Any ideas?

I have this line of code:
PurchaseLine."Unit of Measure Code" := PurchaseLine."Unit of Measure Code"::KG;and after I compile it and run it the line looks like this:
PurchaseLine."Unit of Measure Code" := PurchaseLine."Unit of Measure Code"::"4672511";
Any ideas?
Better to be critical then self-critical 

0
Comments
-
"Unit of measre code" if no optionfield but a codefield.
So the :: assignment is not allowed.
TryPurchaseLine."Unit of Measure Code" := 'KG';
0 -
-
-
It's same as:
PurchaseLine."Document Type" := PurchaseLine."Document Type"::Invoice;
If I omit PurchaseLine and make it:PurchaseLine."Document Type" := "Document Type"::Invoice;
I get compile error : Unknown variable "Document Type"
"Unit of Measure Code" is optionfield.
My code works well, but it gets altered
Code:PurchaseLine."Unit of Measure Code" := 'KG';
works too.Better to be critical then self-critical0 -
:?:
Did you change the datatype of field5407 Unit of Measure Code Code 10
:-s0 -
:oops:
I wrote it wrong (in code and in post), it's not option field.
I had 10 similar lines of code above that one so i guess I didn't think.
#-o
But still, how come the source changed?
The source...option::"2"
after compile does not change to something like:....option::SecondChoice
Or does it? :?:Better to be critical then self-critical0 -
I think the compiler converts all fieldsnames tablenames and optionstrings to numbers.
That's probably why it accepts these numbers
Read this post
http://www.mibuso.com/forum/viewtopic.php?t=75630 -
This is a nice Friday Afternoon topic =D>
:whistle:0 -
No, I didn't mean that.
I did read the post and I understand that but I think that author of that post ment thatSalesLine.Type := SalesLine.Type::Item;
andSalesLine.Type := SalesLine.Type::"2";
give same results.
But it doesn't mean that if I have CodeUnit with codeSalesLine.Type := SalesLine.Type::"2";
and when I do compile, save, close codeunit, open codeunit that that line will say:SalesLine.Type := SalesLine.Type::Item;
True?Better to be critical then self-critical0 -
You are right! :shock:
But that's what the author of the other post (me) is trying to say!
Maybe I should have put it in other words :oops:0 -
The important thing is that the AUTHOR knows the meaning
Well, it's the end of the week O:)
Sorry for telling you what you meant :-#Better to be critical then self-critical0 -
-
br
Josef Metz0 -
Does not work in 4.00 :shock:
Guess the 'bug' is fixed =D>0 -
Mark Brummel wrote:I think the compiler converts all fieldsnames tablenames and optionstrings to numbers.
That's probably why it accepts these numbers
Also option-fields, in reality, are integers.Regards,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