Note that there are some explanatory texts on larger screens.

plurals
  1. POReturning EDT arrays from method and retrieving it, AX 2012
    primarykey
    data
    text
    <p>I have fiddled with this problem for a while and can't seem to find the solution. I'm working on some code another guy originally wrote, my job is to get it to work since he didn't get the possibility to finish it.</p> <p>I have created an EDT called MpasMthSalesIndex with array elements containing all the months, Jan - Dec.</p> <p>I make a call to the method (which is in the MpasItemSales datasource) below from a form to get the array returned like this:</p> <pre><code>[MpasMthSalesIndex] = MpasItemSales.MthSales(Year(today())-2); </code></pre> <p>giving me the error: "operand types are not compatible with the operator"</p> <p>it doesn't work. this was what the original code was, and i have tried everything i can come up with to get this array returned. Anyone know how i can do this?</p> <p>HERE'S THE METHOD I CALL:</p> <p>What i do is initializing the MpasMthSalesIndex Ret, and fill it with values and try to return it, no errors here, but I get errors when i try to assign it to MpasMthSalesIndex from the form where i need it...</p> <pre><code>MpasMthSalesIndex MthSales(Yr _yr) { int i; int m; date d = SystemDateGet(); date e; Qty YrSales[366]; MpasMthSalesIndex ret; ; switch(_yr) { case(Year(d)) : [YrSales] = this.MpasSalesCurYr; d = dateStartYr(d); break; case(Year(PrevYr(d))) : [YrSales] = this.MpasSalesPrevYr; d = dateStartYr(PrevYr(d)); break; case(Year(PrevYr(PrevYr(d)))) : [YrSales] = this.MpasSalesPrev2Yr; d = dateStartYr(PrevYr(PrevYr(d))); break; case(Year(PrevYr(PrevYr(PrevYr(d))))) : [YrSales] = this.MpasSalesPrev3Yr; d = dateStartYr(PrevYr(PrevYr(PrevYr(d)))); break; } e = dateEndYr(d); while (d&lt;e) { i = DayOfYr(d); m = MthOfYr(d); ret[m] += YrSales[i]; d++; } return ret; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload