NAV 2009 Coding Issues

damodar123
Member Posts: 36
In navision i am writing one complex function with n no of parameters , when i say compile in the function passing parameters it is giving message "reduce the expression so it is less complex"
what to do for that
thanks in advance
Damodar
what to do for that
thanks in advance
Damodar
0
Comments
-
I think there is a limit to the number of parameters you can use (I think it is 19). You'll need to reduce the parameters or restructure them (pass them as an array or a record variable). I usually use a record parameter.0
-
Yes, this limit is there since first versions... I hit this limit few times too...0
-
You can also hit that error when you create a very complex expression, like one (or multiple) of your parameters is not just a value or a variable but a complicated calculation.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
[Topic moved from 'NAV/Navision' forum to 'NAV 2009 (formerly NAV 5.1/'6.0')' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Dear All,
Txs for all your replies,
the problem is mine expression is passing to function is exceeding the line due to which i am enterting the remaining expression splitting in multiple lines but still i am getting the error,
the work around techinque is i have split the expression 2,3 parts and each part is stored in separate variables. when am combining all parts using concatenation then passing it to same as parameter still same error raised
expecting any other method to solve my issue0 -
I think it doesn't matter if you store it in separate variables. its number of paramteres you have defined in the called function. if you use fewer number of parameteres in the function , it may reolve your issue.
cheers0 -
dear srivas,
but in my case i have to use more number of parameters0 -
I think its best to break function in to multiple functions and call each function in orderly manner.0
-
You need to use array to store more parmeters in one "parameter of the function". Or use some table or record to pass the value as one parameter. Or use Global variables if the function is claled locally to "pass" the parameters. There is no way how to use "more" parameters in standard way. You need to think about some workaround as described in previous posts...0
-
Srivas wrote:I think its best to break function in to multiple functions and call each function in orderly manner.
This way is used in standard NAV e.g. when creating reservation entries etc. (Sequence of few functions, which set some global variable in the codeunit and these global variables are used in the last function to do what you want...)0 -
The number of variables is a system limitation, there is no way around that, so you can ask the same question ten times, it's not going to change that, so you will have to do something different. Splitting the call up into multiple functions is the right way to go.
So instead of:MainFunction(Par1,Par2,...,Par100);
you would do this:SetFirstVariables(Par1,Par2,...,Par10); SetSecondVariables(Par11,Par12,...,Par20); .... SetTenthVariables(Par91,Par92,...,Par100); MainFunction();
The SetVariable functions would store your parameter values in global variables, and the MainFunction would process those values.0 -
You can always pass a record and the record can have all the data instead of parameters.0
-
If you can find a table that has a field for all parameters that could be a solution, but it's not ideal is it. What about unused fields? what about field validation? What about fields that have names that don't make sense for your purpose?
You could consider creating a table with the fields with a number that is far outside the allowed numbering range, and use a temporary variable, which I've heard works. BUT: I have never actually tried that myself, so I would not know for sure if that would work.0 -
you can also pass an array variable as parameter.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