code rules are very important for proper form transformation - they are not trivial though:
http://msdn.microsoft.com/en-us/library/dd338843.aspx
1. question:
why is there "hello world" in the last line of the first box? it does not do anything.
2. question
I
don't get the content of the first box at ALL.
<find>
CurrForm.!var1!.HEIGHT := TRUE;
<declareVariable>
!var1!Height
<declareVariableType>
Integer
<replace>
!declaredVariable! := TRUE;
what does
!var1! do?
what does
<declareVariableType>
Integer do ?
The replaced variable is not even Integer here... thats really weird :?
Comments
The example given is a little confusing because it also has a comment in columns 2 and 3 of the table, but these are unrelated to the <comment> in column 1.
2. !var! (or !var1! or !var2!, etc.) lets you specify a variable in a code rule. The <declareVariable> special word specifies that the transformed code must declare a variable. <declareVariableType> specifies the data type for this new variable. You use !declaredVariable! in the code rule where you want the transformed code to use the new variable that was declared.
The example given is confusing because as you mention, is assigns a Boolean value to an Integer. A better example would be this one, from the actual CodeRules.txt file:
Then if you have code like this:
It would be transformed to this:
Hope that helps.
I have updated the Code Rules topic to try to make it clearer. The updated version will be available on MSDN (http://msdn.microsoft.com/en-us/library/dd338843.aspx) in a few months when we next update the Developer and IT Pro Help.
Senior Technical Writer
Microsoft Dynamics NAV
@1.
You say the "//comment" in column two is not needed, but isn't this a integral part of the "code rule" itself. How can this be unrelated?
The "Hello World" in the last line of the first column freaks me out, what does it do?
Please don't wait for uploading the MBS in a few months... the partners and ISVs need this now.
<comment> in the first column specifies that the next line(s) of the CodeRules.txt file are comments. These lines don't map to anything in the code on the form. They are ignored by the transformation tool.
You could have something like this in the CodeRules.txt file:
The <comment> line and the next three lines are ignored. When the transformation tool gets to the <replace> line, it recognizes the <replace> special word and knows that the comments have ended.
The above is exactly the same rule as
In the example from your original post: The Hello world line does nothing.
Also, since there is no <replace> in that example, the found line is deleted.
Make sense?
Senior Technical Writer
Microsoft Dynamics NAV