Is there a special variable that needs to be

MichaelleeMichaellee Member Posts: 65
Hi all,


I am trying to find all the unique SOs' for an item that it is reserved for.

e.g Item 1234 has some stock reserved for SO1234 and SO1235 but the stock is in multiple bins and thus there are more than one reservation entry for each SO. I want to be able to place the SO number in a text field to display on a report, so the result I am looking for is "SO1234, SO1235".

I have used some code:

Variable

arrays Text 100
x Integer
y Integer
SOCollate Text 250
Res Record Reservation Entry

Code
x:=1;
y:=0;

IF Res.FIND('-') THEN
REPEAT
arrays[x] := Res."For ID";
repeat
if arrays[y] = Res."For ID" THEN
Test=TRUE;
UNTIL y=x-1 OR Test=TRUE;
IF Test = FALSE Then
SOcollate := SOcollate + ', ' + Res."For ID";
UNTIL rES.NEXT=0;

My issue is that when I try to compile, I get the error message 'Type conversion not possible because 1 of the operators contains an invalid type, Char:= Code'

Am I missing something?

Many thanks for any help.

Mike

Answers

  • DaveTDaveT Member Posts: 1,039
    Hi Michael,

    The compiler is picking up that you are using a char from the string "arrays". To make it into an array you need to set the dimensions property on the variable.

    You could also solve it in the report with grouping or using the currreport.showoutput on the section
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • kinekine Member Posts: 12,562
    Are you sure that you set the Dimension property of the variable "arrays"? It seems that not and thus the indexing leads to single character of the string and not the x-th element of the array... 8)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • MichaelleeMichaellee Member Posts: 65
    Thanks the help guys. Can you p[ossibly tell me what to set the dimension to? I am a relative newbie to the development scene and can't seem to find literature on how to start developing...

    Mike
  • MichaelleeMichaellee Member Posts: 65
    Thanks the help guys. Can you p[ossibly tell me what to set the dimension to? I am a relative newbie to the development scene and can't seem to find literature on how to start developing...

    Mike
  • DaveTDaveT Member Posts: 1,039
    Hi Mike,

    The dimension would have to be set greater than the number of orders returned - depends on data. I would advise you to use showoutput commend in the report which you can control.

    e.g.
    in the OnPreSection() on the section of the report add in somthing like


    currreport.showoutput( oldSOcode = Res."Source Ref. No." );
    oldSOcode := Res."Source Ref. No.";

    This dataitem will need the sorted by Source ref. no. for this to work.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • DenSterDenSter Member Posts: 8,305
    Open the variables window (locals or globals work the same), put your cursor on the variable that you want to define as a variable, then open the properties window. The dimension property is the last one on that little list. The value represents the maximum number of elements in your array.
  • kinekine Member Posts: 12,562
    Because you are using "array[x]" I thought that you know how the arrays are set in NAV - in the Dimension property you can set max. no. of elements for each dimension . For more info and example, please press F1 when standing on the Dimensions property. :wink:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • MichaelleeMichaellee Member Posts: 65
    Thanks for all the helpful posts. I have now worked out where I was going wrong. Thanks again!

    Mike
Sign In or Register to comment.