Error msg:Reduce the expression so it is less complex

poststationpoststation Member Posts: 17
hi, Is there anybody ever see this error message when you compile the code. "Reduce the expression so it is less complex", I got this message when I call a function has 17 parameters.
Is there anybody can tell me why?
Michael

Navision Consultant

Comments

  • DenSterDenSter Member Posts: 8,304
    17 parameters???? wow :shock:

    I don't know the maximum number of parameters, but that might be the cause of this message. I'd probably try to split the functionality into pieces and call them separately.
  • ara3nara3n Member Posts: 9,255
    Or maybe use a temp record as a paramter and fill it with data and pass that record as a paramater.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • poststationpoststation Member Posts: 17
    In standard NAV, Sales Analysis View can only analyse by 3 Dimension, I want to add to 4 Dimension, so I modified some code. These is a function named "CalcActualAmount" in codeunit 7153, it already had 16 parameters, I add a parameters named "Dim4Filter", when I Compile the code, the error message occured.
    Michael

    Navision Consultant
  • poststationpoststation Member Posts: 17
    Any explanation?
    Michael

    Navision Consultant
  • PhennoPhenno Member Posts: 630
    Any explanation?

    http://www.mibuso.com/forum/viewtopic.p ... expression

    There is no explanation, C/AL is limited more/less as any other language. You should try to change "aproach" to the problem and instead forcing of 17th parameter maybe try solution ara3n said, with temptable or array?

    In my case I had need for additional dimension but found that one of standard dimension is not in use so I switched that dim to one that I needed.
  • poststationpoststation Member Posts: 17
    Thanks for all your reply!

    And I found there are exist functions, some have 16 parameters, some have 18 parameters, some have 15 parameters. if you add one patameter, the error occur. so I think there is no stardard parameter limited, maybe MS can add more parameters, but we can't.
    Michael

    Navision Consultant
  • PhennoPhenno Member Posts: 630
    Thanks for all your reply!

    And I found there are exist functions, some have 16 parameters, some have 18 parameters, some have 15 parameters. if you add one patameter, the error occur. so I think there is no stardard parameter limited, maybe MS can add more parameters, but we can't.


    I think that a problem is of rather different nature. Imagine one memory pool for in/out variables of function. That pool is limited only bye size. So, theortically, you can set only 1 var, but very huuge one (size of that pool). every var must reserve space in memory. You will than have a function that can have only 1 parameter.

    I think, MS limited that memory pool to some size. (but, that is only my opinion).
  • jesamjesam Member Posts: 100
    I think, MS limited that memory pool to some size. (but, that is only my opinion).
    In fact, I think Navision limited that memory pool to some size, MS never unlimited it.
  • PhennoPhenno Member Posts: 630
    jesam wrote:
    I think, MS limited that memory pool to some size. (but, that is only my opinion).
    In fact, I think Navision limited that memory pool to some size, MS never unlimited it.

    You are probably right. It's annoying feature although we rarely need it, that special one moment where we need it can be frustrating.
  • girish.joshigirish.joshi Member Posts: 407
    Quite frankly, there is never any reason to do it. I can think of three or four ways to handle it off the top of my head.

    TempTables and arrays were already mentioned (probably the best way to go)

    Another way is to store the variables as globals. Set them before you call the function, and then just have the function refer to the globals instead.
Sign In or Register to comment.